1.

Private member functions ____________(a) Can’t be called from enclosing class(b) Can be accessed from enclosing class(c) Can be accessed only if nested class is private(d) Can be accessed only if nested class is publicThe question was asked in semester exam.My doubt stems from Private Member Functions topic in division Member Functions & its Types of Object Oriented Programming

Answer»

Right option is (a) Can’t be called from ENCLOSING CLASS

Easiest EXPLANATION - The NESTED class members can’t be accessed in the enclosed class even THOUGH other members can be accessed. This is to ensure the class members security and not to go against the rules of private members.



Discussion

No Comment Found

Related InterviewSolutions