+ 1
Are protected members accesible from the base class and the derived class or only from the derived class?
3 Antworten
+ 1
protected => same class and derived
private => only class
0
protected members of the base class are accessible from the derived class only, but not the other way round. In other words, members of the derived class ( either protected or not) can not be accessed from the base class.
0
Members declared within the base class would always be accessible by the base class, whether protected or not (as it's within the same class). The protected members differ only when a derived class is trying to access them.
Members in the derived class would not be accessible to the base class as the derived class essentially wouldn't exist before the base class is compiled.