Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
CPP 3
« Previous
Next »
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
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲