Ive started to get my head in a bit of a mix regarding how Java and C++ pass arguments.
Is this correct:
Java passes using call by value, but the value is actually the reference (not the actual data/object). So a copy of the address is made?
C++ by default, passes by value, but the value is not the reference, its the actual data. If you want to simular real call by reference use &
or a pointer?
In summary, Java makes copies of parameters, but it's a copy of the reference. C++ usually makes a copy but not of the reference (unless you use &
or pointers), of the actual underlying data?
C++(03) always makes a copy unless you pass by reference. (Theoretically... in practice, copy elision can occur, but it's irrelevant in regards to the question)
If you pass by pointer, you still make a copy (granted, it's a copy of the pointer, but still a copy).