saving . . . saved Inheritance has been deleted. Inheritance has been hidden .
Inheritance
Title
Question
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 13px;">Can we use private members of base class which is stored in public member of same class in the derived class as you done in this tutorial using sub1,sub2,sub3 which is stored in public member total and then access this total in derived class?Cann't we use here access specifier protected?</span>

Advanced-Cpp Inheritance 04-05 min 50-60 sec 11-04-20, 2:21 p.m. Mann_19

Answers:

Please read the Data hiding rules:
1. Private members are not directly accessible by any derived classes.
2. Protected members always remain protected in the public and protected derivation of the derived classes, and change to private in private derivation.
3. Public members can be accessed outside the base class. Public members are inherited as public, protected, and private in the derived classes, based on the derived class derivation.

-nags
29-04-20, 12:56 p.m. nags
<span id="yui_3_10_0_1_1620040955389_601" style="color: rgb(82, 82, 82); font-family: &quot;helvetica neue&quot;, helvetica, arial, sans-serif; font-size: 14px;">The capability of a class to derive properties and characteristics from another class is called</span><span style="color: rgb(82, 82, 82); font-family: &quot;helvetica neue&quot;, helvetica, arial, sans-serif; font-size: 14px;"> Inheritance. Inheritance is one of the most important feature of Object Oriented Programming. Sub Class: The class that inherits properties from another class is called Sub class or Derived Class. The inheried class is called as child class</span>
03-05-21, 4:54 p.m. saravana_7528

Login to add comment


Log-in to answer to this question.