B
bilaribilari
Hi,
I came across a function which looks like this:
void func ( Object *& param1 )
{
....
}
Can someone please explain what does *& mean? Where can I get a good
understanding of 'pointer to reference' and 'reference to a pointer' if
any such thing exists. Whats the purpose of doing something like this?
Also, if I have a function that is like this:
void func ( Object * param1 )
{
....
param1 = new Object ();
....do something to param1
}
int main ()
{
Object * x = new Object () ;
func ( x );
Object x ;
func ( &x );
}
What happens to x in the above cases?
Thanks a lot in advance.
Best regards,
B.
I came across a function which looks like this:
void func ( Object *& param1 )
{
....
}
Can someone please explain what does *& mean? Where can I get a good
understanding of 'pointer to reference' and 'reference to a pointer' if
any such thing exists. Whats the purpose of doing something like this?
Also, if I have a function that is like this:
void func ( Object * param1 )
{
....
param1 = new Object ();
....do something to param1
}
int main ()
{
Object * x = new Object () ;
func ( x );
Object x ;
func ( &x );
}
What happens to x in the above cases?
Thanks a lot in advance.
Best regards,
B.