1.

The address of the object _________________(a) Can’t be accessed from inside the function(b) Can’t be accessed in the program(c) Is available inside the member function using this pointer(d) Can be accessed using the object name inside the member functionThis question was posed to me during an internship interview.Asked question is from This Pointer in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Correct option is (c) Is available inside the member function using this pointer

Best explanation: The ADDRESS of the OBJECT with RESPECT to which the member functions are being called, are stored in this pointer. This pointer is hence used whenever there are MEMBERS with same name as those of the VARIABLES inside the function.



Discussion

No Comment Found

Related InterviewSolutions