4 ms·
They use pass by value but objects are reference valued.
by treewalking 4y ago
They use pass by value but objects are reference valued.
- icedchai 4y agoYes, I understand... But the result, practically speaking, is objects are passed by reference, just like I said. Methods/functions can modify their parameters.
- foepys 4y agoBut you cannot change the reference itself which is possible in languages like C, C++, C#, and many more.
- ShroudedNight 4y agoIt's been a while, but my understanding was that actual C++ references were immutable, and what you are describing can only happen as a result of passing a pointer by value.
- westmeal 4y agoYeah, you cannot 'reassign' a reference. The compiler will yell at you if you try. You can definitely modify values of your referenced object though, that's fair game. When it comes to pointers you can do whatever the hell you want but be careful.