When should a member of a class be declared public?

1 answer

Answer

1228714

2026-08-06 08:56

+ Follow

When the member needs to be accessible from outside of the class. Private members are only accessible from within the class itself, including friends of the class. Protected members are the same as private members but are also accessible to derived classes. Derived classes therefore inherit both the protected and public members of its base classes.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.