Access Modifiers - Nathan-Groves/2143-OOP-Groves GitHub Wiki

Are known as access specifiers, and denote the ability of a class to access the members and data of the class.

Private

Can only be accessed my member functions within the class.

Public

Can be accessed by any object from the class, outside the class, or in a subclass.

Protected

Can be accessed by derived subclasses, but not the class itself or outside the class.

class Bank {
private:
int money;

protected:
int safePasscode;

public: 
int getMoney ();

};