I have read on wiki, they say that:
on page Reference (C++) - Wikipedia, the free encyclopediaThere shall be no references to references, no arrays of references, and no pointers to references.
I don't know why they say that, because I have do them (referencees to references, pointers to references, references to pointers and see that no error.)
this is my code:
And no problem appears, it will prints 6 at all.Code:int a=6; int& ref_a=a; //reference to variable int* ptr_a=&ref_a; //pointer to reference int& ref_a2=ref_a; //reference to reference cout<<ref_a<<endl<<*ptr_a<<endl<<ref_a2<<endl;
So, who can explain why wiki said that, am I understand wrong ? Talk to me, please.
thanks![]()



LinkBack URL
About LinkBacks




