Hacker News new | comments | show | ask | jobs | submit login

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).



Object 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#).




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: