access specifiers in c++

 

 Access specifies in C++  .

These get to specifiers characterize how the individuals from the class can be gotten to.

Obviously, any individual from a class is open inside that class(Inside any member function of that same class).

Pushing forward to sort of get to specifiers

C++ has three visibility label or access specifies 

 

  1. Private mode —  the class members that have  been declared as private can be accessed only from within the class.  In other words the private key word is used to  prevents direct access the member variables or functions by the object, such feature is known as data hiding features of the oops.
  2. Public mode —  if data members and member function is defined under this access specifiers. they  can be accessed by the function defined out side the class.  In other words public member can be accessed from  outside the class. In other words the key word public can be used to allow   object to access the member variable of class directly like structure.
  3. Protected mode —   the member function and data members defined under this mode are made available only for the member functions of the derived class and not for the outside function.