1.

Non-static nested classes have access to _____________ from enclosing class.(a) Private members(b) Protected members(c) Public members(d) All the membersThis question was addressed to me in final exam.Question is from Nested Class topic in portion Class Members & Types of Object Oriented Programming

Answer»

The correct option is (d) All the MEMBERS

The explanation is: The non-static nested class can ACCESS all the members of the enclosing class. All the data members and MEMBER functions can be ACCESSED from the nested class. Even if the members are private, they can be accessed.



Discussion

No Comment Found

Related InterviewSolutions