C++ Access Specifiers

C++Access Specifiers

C++ Access Specifiers
The commands that are used to specify the access level of class members. These are used to enforce restrictions to members of class.
The syntax of C++ Access Specifier is as follows:
class thiIsClass {  // The class
  public:        // Access specifier
    // class members written here
There are three types of access specifiers
  • Public is used to tell member can be accessed whenever you have access to the object.
  • Private is used to tell member can only be accessed from a member function.
  • Protected to be discussed when we cover inheritance.