DEV Community

Md Rasheduzzaman
Md Rasheduzzaman

Posted on

What are access modifiers in C++?

One of the main features of object-oriented programming languages such as C++ is data hiding. Data hiding refers to restricting access to data members of a class. This is to prevent other functions and classes from tampering with the class data.

You use access modifiers to define accessibility for the class members. It defines how to access the members of the class outside the class scope.

There are three types of access modifiers:

  • Private
  • Public
  • Protected

Image description

Top comments (0)