This pointer in C++

This pointer is a pointer to an object on which the member function is called. It is automatically passed whenever a member function is called. The only exceptions are friend functions and static member functions. These functions don’t have a this pointer. This is usually not written.

For Example: a = b; can also be written as this->a = b;

Leave a Reply