2 ms·
But cpp doesn't have call-by-reference. It has the ability to refer to pointer and reference objects directly and pass those by value. foo(int* x) takes a poin
by UncleMeat 9y ago
But cpp doesn't have call-by-reference. It has the ability to refer to pointer and reference objects directly and pass those by value.
foo(int* x) takes a pointer by value. foo(int& x) takes a reference by value.
- fauigerzigerk 9y agoThat's nitpicking. Pass-by-reference is defined by its semantics, not by an implementation that avoids copying anything. There is no such thing as a "reference object" in C++ that you could pass by value. References may be implemented using pointers under the hood and those pointers may be copied, but on a semantic level references themselves are not objects that you can copy or take the address of (contrary to pointers).