+ 2
Access specifiers Explained?
Please describe That what does it means to a derived class when we specify acces as public, private or protected?
3 Réponses
+ 1
---
class Subclass: public BaseClass
---
This means the members that are inherited from BaseClass are going to be public in the subclass. However, protected members remain protected
---
class subClass : private BaseClass
---
This means the members that are inherited from BaseClass are going to
be private in the subclass.
---
class subclass : protected BaseClass
---
I thing you got the idea. ;)
Useful link: https://stackoverflow.com/questions/860339/difference-between-private-public-and-protected-inheritance
+ 2
Thank Jhon!
what I got is that the specifiers are actually going to be set for our new derived class's members right!!
+ 1
That's true for inherited members. New members can have any access specifier you provide.