+ 1
Can object of derived class access protected member functions of its base class?
3 Antworten
+ 2
If you could, what would be the benefit of using public?
You can access base class properties and methods in you derived class itself (in methods for example), but you can't use them on a object of the derived class.
+ 1
I'm pretty sure you know the answer yourself
+ 1
you create protected member variables because you specifically want them to be used, not in the parent but, in the child class. if you try to assign or use protected varables within the same class you should get errors.