3 ms·
Yet, in c# if you do int foo(obBob o) { o.x += 1; return o; } ... Car.x = 3; foo(Car); Then Car.x = 4 which has confused a lot of new programmers. Mo
by Retric 13y ago
Yet, in c# if you do
int foo(obBob o) { o.x += 1; return o; }
...
Car.x = 3;
foo(Car);
Then Car.x = 4 which has confused a lot of new programmers. More importantly it's a more consice standard for cube(x) to cube(x) than to say x=cube(x).
- seanmcdirmid 13y agoObject fields are always passed implicitly by reference (if that makes sense). The value that holds the reference to the object itself is passed by value, unless you specify the "ref" argument modifier (in C#).