Originally Posted by
Elysia
Not necessarily:
Code:
void foo(int*& mypointer)
I meant confusing.
Code:
int*p or int *p // which is correct?
int *p, *q or int* p, q // now? which is correct?
now:
why int*& p and why not int &*p, &*q // ???
I think that one is a sin not related to references. Same thing happens when you pass it by pointer, as well.
I was citing example when not to pass by reference. Of course you are right too.
It can't be overwritten if you pass it as const.
Dang!
I meant something like this:
Code:
void f(int i) {
static Foo obj;
obj.i = i;
byRef(obj);
obj.i *= 2; // The passed reference is also changed?
}