简体   繁体   中英

Acces type of derived classes

class derived: protected base ==> int this case all protected and public members of the base class are protected for the derived one

class derived: public base ==> int this case all protected and public members of the base class are respectively protected and public for the derived one

in both cases the derived class can access the public and the protected members of the base class, what's the difference ?

The difference is what other classes can access.

It's a question of what gets exposed as public in the end to other classes, not as much as what gets exposed to derived classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM