You mean, for instance, what the difference between this: void f(T &);
and this: void f(T &a);
?
For the compiler, there's no difference. For someone using the function, the latter may be more useful if the parameter names are meaningful and provide insight as to what they are. The latter needs, however, to be kept in sync with the function definition, so you can't have void f(T &a);
and then
If an object is automatically promoted to a reference, does it mean the parameter (the object passed to a function) will be a pointer and should be denoted by ¶m? For example in the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void Vector::functionA() {
...
};
void Vector::print(Vector &another) { // 2. here the parameter is a pointer
// such that the another is the object
cout << &another << endl;
another.functionA();
};
int main() {
...
Vector v1;
v1.print(v1); // 1. here I suppose to give print a reference
...
}
So I am wondering the reason why parameter, I give as a reference, when passed to the function becomes a pointer.