This pointer is automatically passed as an implicit argument to member functions and points to the object whose member function is called. It can be used to access data members and the address of the class object. A static member function does not have a this pointer since it is part of the class but not an object.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
27 views3 pages
This
This pointer is automatically passed as an implicit argument to member functions and points to the object whose member function is called. It can be used to access data members and the address of the class object. A static member function does not have a this pointer since it is part of the class but not an object.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 3
this pointer
C++ provides a unique pointer called
this pointer. The pointer called this points to the objects itself. Whenever a member function is called, this pointer is automatically passed to the called member function as an implicit, in-built argument. Characteristics of this pointer :-
this pointer is an implicit parameter of a
member function. It points to the object on which the function is invoked. this pointer is a pointer to the class type. Therefore it can be used to access the data members of the object. It can also be used to access the address of the class object for which the member function is called. In a const member function, this pointer is a pointer to const.
A static member is part of its class but not
part of an object. Therefore a static member function does not have a this pointer.
Overloaded operators that are member
functions have an implicit this parameter bound to the first operand.