What are the access specifiers in C++?

C++ has three access specifiers :

  1. Private – Accessible only within the class.
  2. Protected – Accessible within the class and derived classes.
  3. Public – Accessible from anywhere.