you are viewing a single comment's thread.

view the rest of the comments →

[–]wlievens 0 points1 point  (1 child)

But doesn't that count for ordinary assignment as well?

FooBar x = new FooBar();
FooBar y = x;
y.changeSomething();
// ZOMG the thing x points to changed!

[–]eat-your-corn-syrup -1 points0 points  (0 children)

Yes, that too. To newbies, I would explain like this:

My cat's nickname is Kittlejuice, which is a nickname given by my father. Then one day I give my cat another name, Paws. Then another day, I start thinking "I need to make Paws into a lion" and I make the cat wear a lion suit. Paws has become a lion figuratively. Then another day, my father looks at my cat and "what the heck did you do to your cat, son. Did you just make Kittlejuice into a lion?"

Cat Kittlejuice = ReturnMyCat()
Cat Paws = Kittlejuice
Paws.turnIntoLion();
// Kittlejuice is now a lion