OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 128
Which of the following is not true in case of public inheritance in c++?
A
Each public member in the base class is public in the derived class
B
Each protected member in the base class is protected in the derived class
C
Each private member in the base class remains private in the base class
D
Each private member in the base class remains private in the derived class
Question 128 Explanation: 
→ Public Inheritance − When deriving a class from a public base class, public members of the base class become public members of the derived class and protected members of the base class become protected members of the derived class.
→ A base class’s private members are never accessible directly from a derived class, but can be accessed through calls to the public and protected members of the base class.
We can summarize the different access types according to – who can access them in the following way −
Correct Answer: D
Question 128 Explanation: 
→ Public Inheritance − When deriving a class from a public base class, public members of the base class become public members of the derived class and protected members of the base class become protected members of the derived class.
→ A base class’s private members are never accessible directly from a derived class, but can be accessed through calls to the public and protected members of the base class.
We can summarize the different access types according to – who can access them in the following way −

Leave a Reply

Your email address will not be published. Required fields are marked *