Re:C++ Papercuts
by raincole on Monday August 28, 2023 @08:22AM
(#37292916)
I'm pretty sure one of the biggest differences between C# and Java is that in C# you can't assume everything is a reference. A strict is passed by value.
[ Parent
| on HN ]
Re:C++ Papercuts
by fluoridation on Monday August 28, 2023 @10:24AM
(#37294505)
No, strings are passed by reference, it's just that the string type is immutable. Passing a string to a function doesn't create a copy, but there's also no way for the callee to modify the object that the caller points to.
It is true that C# has value types that are by default passed by copy, though.