1.

How to access members of the class inside a member function?(a) Using this pointer only(b) Using dot operator(c) Using arrow operator(d) Used directly or with this pointerThis question was addressed to me in an online quiz.This is a very interesting question from Member Functions in section Class Members & Types of Object Oriented Programming

Answer»

The correct ANSWER is (d) USED directly or with this POINTER

The EXPLANATION is: The members of a class can be used directly inside a member FUNCTION. We can use this pointer when there is a conflict between data members of class and arguments/local function variable names.



Discussion

No Comment Found

Related InterviewSolutions