I know the this
pointer will point to the object instance that currently in, but I don't know how to implement it.
And I found that in standard 7.5.2 said:
The keyword this names a pointer to the object for which an implicit object member function ([class.mfct.non.static]) is invoked or a non-static data member's initializer ([class.mem]) is evaluated.
but in 12.2.2 said constructors do not have implicit object parameter, then why I can use this
pointer in constructor?
then I have several question comming, so my question is:
Does the
this
pointer belongs to the class?I think the answer is NO, but I wanna confirm it.
Does all class instance shared the constructors and destructor?
I knew that the class instance will share the member function, does it same on constructors and destructor?
How the
this
pointer was implemented?Is there something like virtual table to maintain the
this
pointer?Why I can use the
this
pointer in constructor?The
this
point to the implicit object, but constructor didn't have the implicit object parameter, then how could thethis
pointer worked well?
Any additional supplements and recommendations are appreciated.
Edit:
This stackoverflow helps me a lot : Does a constructor also have an implicit this parameter