1.

Which data members can be inherited but are private to a class?(a) Private(b) Protected(c) Protected and Static(d) Privately inheritedI have been asked this question in an interview.The origin of the question is Data Members in chapter Class Members & Types of Object Oriented Programming

Answer»

Correct answer is (b) Protected

To explain I WOULD say: Static MEMBERS inheritance ALSO depends on the TYPE of specifier they have. Only the protected members can be inherited but remain private to class. If static members are defined in private access, they won’t be allowed for inheritance.



Discussion

No Comment Found

Related InterviewSolutions