1.

Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is used, those become private and if public used, those become public)(a) Private member functions(b) Protected member functions(c) Public member functions(d) All member functionsThis question was addressed to me during an interview.My question is from Public Member Functions topic in portion Member Functions & its Types of Object Oriented Programming

Answer»

The correct answer is (c) Public MEMBER FUNCTIONS

Explanation: The public member functions gets into the same specifier in which the inheritance is done. If PROTECTED members are INVOLVED in public inheritance, still those remain protected in the derived class but public members BECOME public on public inheritance and protected in protected inheritance.



Discussion

No Comment Found

Related InterviewSolutions