| This brings up a different question -
If passing the value of a reference is not passing by reference, then what is? Passing the value of a reference to the reference?
This is irrelevant to Java, so I'm going to have to switch gears here... I hope nobody minds...
In C/C++ (disclaimer: I actually know hardly any C/C++ - I may and probably will get something wrong during this), when you pass something to a function, whether it's a primitive or a class, it creates a copy and uses the copy. The original stays exactly the same.
You can also pass a pointer, such as an int*. This will copy the pointer, which is a reference to a memory location - very much like the object names in Java.
You can also use &variable, which is the 'pass by reference' syntax. But how does it pass by reference if not by passing a copy of the value of the reference? As I said before, the only way I can think of passing a reference without copying it is to create a reference to the reference - but that doesn't seem like an efficient way of going about things. |