1.

How does compiler decide the intended object to be used, if more than one object are used?(a) Using object name(b) Using an integer pointer(c) Using this pointer(d) Using void pointerThe question was asked by my school principal while I was bunking the class.The above asked question is from Pointer to Objects in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right option is (C) Using this pointer

To explain I WOULD say: This pointer denotes the OBJECT, in which it is being used. If member function is called with respect to ONE object then this pointer refers to the same object members. It can be used when members with same name are INVOLVED.



Discussion

No Comment Found

Related InterviewSolutions