Non-static function members of a class gain access to the calling object’s members by
a. a pointer to the calling object that is implicitly provided by the compiler. The name of this pointer is this. Members are prefixed implicitly by this->, as in
this->membername
b. a variable called self that is an alias for the calling object. This self is used to access the members of the object.
c. There is no particular mechanism, the variables just know what the calling object is and automatically refer to the calling object.
d. None of the above.
a)
Explanation: The “this” pointer is implicitly passed to every constructor, destructor and all other non-static member function. this-> is an automatic prefix that is applied to every member of the class in the definition of function members.
Computer Science & Information Technology