+ 1
this pointer in C++
Confusing...!!!
2 Respuestas
+ 1
Not really, once you get it!
Try the following code and see what it outputs:
class A{
public :
A* getThis(){return this ;}
};
int main() {
A* a = new A;
cout << a << endl ;
A* a2 = a->getThis();
cout << a2 << endl;
return 0;
}
0
Thanks @EttienneGilbert