Inherit data members | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Inherit data members

Theres aby way to inherit data members apart of methods? or something similar. If in the mother class are protected data members, and inherit a method that set those data, if I create an obj of a daughter class and inherit the set method, the obj got its own data members too? Thx

27th Jul 2019, 3:48 PM
BinaryEden
BinaryEden - avatar
1 Answer
+ 2
the protected data member of mother class are also visible to the inherited daughter class and the data member of daughter class are also visible to its own member functions
18th Aug 2019, 6:52 AM
Sami
Sami - avatar