July 2013
Intermediate to advanced
124 pages
1h 42m
English
CHAPTER 16
![]()
Access Levels
Every class member has an accessibility level that determines where the member will be visible. There are three of them available in C++: public, protected and private. The default access level for class members is private. To change the access level for a section of code, an access modifier is used followed by a colon. Every field or method that comes after this label will have the specified access level, until another access level is set or the class declaration ends.
class MyClass{ int myPrivate; public: int myPublic; void publicMethod();};
Private access
All members regardless of their access level are accessible ...
Read now
Unlock full access