Explain the difference between the protected and public members of a class.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Explain the difference between the protected and public members of a class.

Since you are not specified the programming language, we are answering the question in C++. Thank you!
Access specifiers:
Access specifiers in C++ class are used to define the access control rules for the member functions and member variables.
- Access specifiers are used to set boundaries for the member variables and member functions.
- It is succeeded with the single colon ":"at the end.
- One, two or all 3 access specifiers can be used in the same class in order to set different boundaries for different class members.
In C++, there are three type of access specifiers. They are,
- Public
- Private
- Protected
Step by step
Solved in 2 steps with 1 images









