In C++, there are three access specifiers for classes : public, protected, and private. These are important for encapsulation. A public member is one that can be accessed by any code. A protected member can only be accessed by methods in the class and its derived class. A private member can only be accessed by methods in the class itself. A friend to the class may access a member regardless of access specifier. (friends violate encapsulation and are a Bad Thing)

Log in or registerto write something here or to contact authors.