Which of the following members do get inherited(in case of private inheritance) but become private members in child class

Options
- Public
- Private
- Protected
- All the above


CORRECT ANSWER : All the above

Discussion Board
incorrect answer

The correct answer is a) and c).
Indeed, in case of private inheritance, protected and public members become private in the child class.
For the private members, they are never visible to the child class independently of the type of inheritance.

seif 12-9-2016 09:09 AM

It depends of the type of the inheritance

If the inheritance is Public, no changement: the protected stays "protected", public stays "public" and private stays "private"
If the inheritance is Protected, the protected stays "protected", public becomes "protected" and private stays "private"
If the inheritance is Private, the protected becomes "Private", public stays "Private" and private stays "private"

Yves Alain 07-13-2015 06:43 AM

Yoy are right Alexandre

Private have highes priority

Aniket 07-5-2015 01:03 PM

Incorrect answer!!!

Every body paticipate in inheritance. But private can't be accessible in any of the inheritace chain. So answer would be private if you are using public inheritance.
In case of private inheritance, protected also can't be avialable for access in derive classes.
But remember whats ever the inheritance is all private/public/protected data occupies space in final object/ child object.


Subrat 12-31-2014 02:48 AM

Protected remains protected

A protected member remains protected in the whole children hierarchy.

Alexandre Thibodeau 12-15-2013 12:18 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement