+ 2
C++ - Inheritance and access specifiers
What are access specifiers in derived classes of protected and public members of a base class? Are rules equal in other OO languages (Java, C# and so on)?
4 odpowiedzi
+ 5
✓Private inheritance:
Public and protected members of base class become private of the derived.
✓Protected inheritance:
Public and protected members of base become protected members of derived.
✓Public inheritance:
Protected members are made protected and public members are made public.
NOTE : in any kind of inheritance the security level of datatypes does not decrease. And private members are never derivable.
+ 4
Sorry, probably I wasn't clear.
Protected attributes of base class, in derived classes do they become private, protected or public?
And public attributes of base class?
+ 2
The access specifiers of classes are :
- private
- protected
- public
I believe they serve the same purpose in many, possibly all programming languages.
http://www.trytoprogram.com/cplusplus-programming/access-specifiers/