1.

How to access data members of a class?(a) Dot operator(b) Arrow operator(c) Dot or arrow as required(d) Dot, arrow or direct callI had been asked this question during an interview.My question is from Data Members topic in chapter Class Members & Types of Object Oriented Programming

Answer»

Right CHOICE is (c) Dot or arrow as required

The EXPLANATION: The DATA members can never be called directly. Dot operator is USED to access the members with help of object of class. Arrow is USUALLY used if pointers are used.



Discussion

No Comment Found

Related InterviewSolutions