1.

If base class contains 2 nested classes, will it be possible to implement single level inheritance?(a) Yes, always(b) Yes, only if derived class also have nested classes(c) No, it will use more than 2 classes which is wrong(d) No, neverThe question was asked during an online interview.The origin of the question is Single Level Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

Right choice is (a) Yes, always

To explain: The nested classes are also members of a CLASS. They BEHAVE as a used defined data type with some methods implementation. So the INHERITANCE will be as usual with the nested classes being member of BASE class and of derived class if not private.



Discussion

No Comment Found

Related InterviewSolutions