|
|
|
|
|
by TheCoelacanth
2977 days ago
|
|
In C++, terms void f(Foo x); // pass-by-value
void f(Foo* x); // pass-pointer-by-value
void f(Foo& x); // pass-by-reference
In the last example, you aren't passing in a value, you are essentially creating an alias for some variable in the calling scope. |
|
The only real difference between the last two is that the last one shouldn't be sent in as null, isn't it? The test in OPs artictle doesn't really make sense either, because you can switch the values using pointers as well.