Suppose, 'Happening' and 'Accident' are two classes. What will happen when Happening class derives from Accident class by using private visibility?
Advertisements
Question
Suppose, 'Happening' and 'Accident' are two classes. What will happen when Happening class derives from Accident class by using private visibility?
Short Answer
Advertisements
Solution
- The derived class (Happening) can use public members from the base class (Accident).
- The derived class (Happening) can use protected members from the base class (Accident).
- Private members from the base (Accident) class cannot be utilized in the derived class (Happening).
shaalaa.com
Is there an error in this question or solution?
Chapter 8: Encapsulation and Inheritance - EXERCISES [Page 446]
