Example & Tutorial understanding programming in easy ways.

What is the Access modifier in C++ ?

What is Access modifier?
in C++, there are 3 access modifier, i.e., public, private, protected.

Why Access modifier is used?
Access modifiers are used to implement an important feature of Object-Oriented Programming known as Data Hiding.

What is 'public' modifier:
Data member and data method which are declared as public are accessible from anywhere(inside or outside class).

What is 'private' modifier:
Data member and data method which are declared as private are accessible only within class.

What is 'protected' modifier:
Data member and data method which are declared as protected are accessible in same class or child class.




Read More →