Example & Tutorial understanding programming in easy ways.

What is the access specifier in C++?

Access specifier in C++ :

-The access specifiers are used to define how to functions and variables can be accessed outside the class.

-There are three types of access specifiers: 

1. Private: Functions and variables declared as private can be accessed only within the same class, and they cannot be accessed outside the class they are declared. 

2. Public: Functions and variables declared under public can be accessed from anywhere.

3. Protected: Functions and variables declared as protected cannot be accessed outside the class except a child class. This specifier is generally used in inheritance.

Read More →