Q:

What is “this” pointer in c++?

0

What is “this” pointer?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

The “this pointer” is a pointer accessible only within the member functions of a class, struct, or union type. It points to the object for which the member function is called. Static member functions do not have this pointer. When a nonstatic member function is called for an object, the address of the object is passed as a hidden argument to the function.

An object’s this pointer isn’t part of the object itself. It’s not reflected in the result of a sizeof statement on the object.

Note: The friend functions also do not have this pointer, because friends are not members of a class.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions and Answers(2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Where we should use this pointer in C++?... >>
<< What is the difference between constructor and des...