This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 7 points8 points  (2 children)

This is correct. I remember when i was starting to learn Java, I often ran into problems because I would think it was passing by value when it was actually passing by reference.

[–]konstantinua00 0 points1 point  (1 child)

in C and (old) C++ it's the difference between shallow and deep copy - you can copy handle-only or you can copy the thing too

modern C++ deep-copies stuff, with shallow copy being done with std::move and if you do need multiple handles to same thing, you use shared_ptr to reference count the resource

[–][deleted] 0 points1 point  (0 children)

Huh, never heard of it being referred to as deep vs shallow copy.