+ 2

Access specifiers Explained?

Please describe That what does it means to a derived class when we specify acces as public, private or protected?

10th Feb 2019, 12:43 PM
Usman Amin
Usman Amin - avatar
3 odpowiedzi
+ 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
10th Feb 2019, 1:11 PM
Jhon
Jhon - avatar
+ 2
Thank Jhon! what I got is that the specifiers are actually going to be set for our new derived class's members right!!
10th Feb 2019, 5:44 PM
Usman Amin
Usman Amin - avatar
+ 1
That's true for inherited members. New members can have any access specifier you provide.
10th Feb 2019, 5:46 PM
Jhon
Jhon - avatar