1.

Which among the following is true?(a) this pointer is passed implicitly when member functions are called(b) this pointer is passed explicitly when member functions are called(c) this pointer is passed with help of pointer member functions are called(d) this pointer is passed with help of void pointer member functions are calledThe question was posed to me in homework.Asked question is from This Pointer in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right ANSWER is (a) this pointer is passed implicitly when member functions are called

Easy explanation - When an object CALLS some member function, it implicitly PASSES itself as an argument. This allows the compiler to KNOW which member should be used for the PURPOSES. This also allows to reduce the ambiguity among the variable and data member names.



Discussion

No Comment Found

Related InterviewSolutions