1.

Which among the following is true?(a) This pointer can be used to guard against any kind of reference(b) This pointer can be used to guard against self-reference(c) This pointer can be used to guard from other pointers(d) This pointer can be used to guard from parameter referencingThe question was asked by my college director while I was bunking the class.The origin of the question is This Pointer in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer» RIGHT answer is (b) This pointer can be used to GUARD against self-reference

For explanation: The this pointer can be used to guard itself whenever self-reference is used. This ALLOWS accidental ADDRESS ACCESS. And accidental modification of data.


Discussion

No Comment Found

Related InterviewSolutions