1.

How can you make the private members inheritable?(a) By making their visibility mode as public only(b) By making their visibility mode as protected only(c) By making their visibility mode as private in derived class(d) It can be done both by making the visibility mode public or protectedThis question was posed to me in homework.Question is taken from Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

The correct option is (d) It can be done both by making the visibility mode public or protected

The EXPLANATION is: It is not mandatory that you have to MAKE the visibility mode either public or protected. You can do either of those. That will GIVE you permission to inherit the PRIVATE members of BASE class.



Discussion

No Comment Found

Related InterviewSolutions