What are the differences between public, private, and
protected access?
Answer Posted / krishnachaitanya narne adeesh
Public data is used to access from any where in the program
means any class or any member function can utilize those
variables and member functions.
Where as Private data will not give access to any other
classes and also for derived classes it use those variables
only on particular class only.
Here Protected is similar to Private but difference is just
it gave access to its derived classes also. This is also
opposite to Public.
| Is This Answer Correct ? | 46 Yes | 9 No |
Post New Answer View All Answers
What is the c++ code?
Give 10 points of differences between C & C++.
What is late binding c++?
what is the use of void main() in C++ language?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
Do you know what are static and dynamic type checking?
How to get the current position of the file pointer?
Why cstdlib is used in c++?
Explain the static storage classes in c++.
Is c++ a difficult language?
Can a constructor be private?
Write a Program to find the largest of 4 no using macros.
Are there any special rules about inlining?
Who discovered c++?
How do you remove an element from a set in c++?