Exactly a const reference is ok but what the book seemed to imply was that something like:
Code:
void foo ( int &a )
{
a = 5;
}
is less desirable then say
Code:
void bar (int *a)
{
*a = 5;
}
Because of the function call itself:
Code:
int b=10;
foo ( b ); // No idea that b won't be 10 afterwards
bar ( &b ); // Now I have an idea that b might be different afterwards
And for those of you who want to argue ease of use inside the functions I present:
Code:
void foobar (int *paraA)
{
int &a = *paraA;
a = 5;
}