0
Inheritance for private member
As far as I know , private embers of base class are not accessible in derived class... I heard (very first time) that private member are inherited , but those are not accessible... is this true? if those are inherited but not accessible, then what is the usecase of this scenario?
3 odpowiedzi
+ 2
yes it is true thing private members are inherited.
here is the code of verification. I have verified by printing the size of object.
https://code.sololearn.com/cbOD6FCQxDi8/?ref=app
also private members arenot accessible in derived class.
it is programmers responsibility to design a robust code and accordingly put a decision to take private data members.
+ 2
Ketan Lalcheta man a big salute to you. You have earned 48k xp in c++.
+ 1
great to know this.... never thought about this anytime before...