I'm wondering about C++ reference value working mechanism.
For this code, I think that it should be return error at position 1 but it return the error at position 2. It seems referencing variable works like a macro. Is it right??
void function()
{
foo* a = NULL;
int& b = a->member(); /// position 1
cout<<b<<endl; /// position 2
}
Aucun commentaire:
Enregistrer un commentaire