Home >Topic List >The role of c++this pointer

The role of c++this pointer

The functions of this pointer are: 1. Access the member variables and member functions of the current object in the member function. The member function can access the member variables of the object through this pointer. When calling a member function of an object, the compiler automatically The address is passed to the this pointer, so that the this pointer can be used to access the member variables of the object in the member function; 2. Call other member functions in the member function. When a member function calls another member function, the compiler will automatically The address is passed to the this pointer of the called member function.