1.

Which call is correct for public members of a nested class?(a) Can be called from object of enclosing class(b) Can be called within enclosing class only with direct names(c) Direct names should be used for the nested classes(d) Only with help of nested class object pointerThis question was addressed to me during an interview.This interesting question is from Public Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming

Answer»

Correct answer is (a) Can be called from object of enclosing CLASS

Easiest explanation - The closest DEFINITION is that any PUBLIC MEMBER function of the nested class can be accessed with the help of enclosing class object. The nested class object pointer can be used only within the enclosing class. It’s not mandatory to use the MEMBERS of nested class only within the enclosing class.



Discussion

No Comment Found

Related InterviewSolutions