+ 1
But really, what is the main difference between "Private" member and a "Protected" member
5 Respuestas
+ 2
You cant inherite private member. Pls specify what do you mean by call private from base class.
+ 2
no you can't access them directly, as you can access public and protected member via a child class object.
Private members are only accessible by the members of same class. if you try to access them outside the class directly , compiler will through you an error.
( unless you are using a friend class or friend function).
but yes you can access them indirectly by accessing base class's public or protected member inside another class.
+ 1
Main difference between them is,
protected can be inherit , while private can't.
0
Private member can be use only inside the class and cant be inherite. The protected member can be use only inside class but can be inherite.
0
but we can still call the variable (or const) that is in the private of the base class.. to the "daughter" class. is that not similar to inheritance?