What is the purpose of the this pointer in C++? 

  • To return the current object's address. 
  • To point to global variables. 
  • To create a new object. 
  • To delete the current object.
In C++, the this pointer is used within a class's member function to refer to the invoking object of that function. It's an implicit parameter to all member functions and contains the memory address of the current object, allowing for operations on the calling object itself.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *