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 can I use instead of namespace std?
Describe linked list using C++ with an example.
What is function overloading in C++?
What gives the current position of the put pointer?
Can we make copy constructor private in c++?
What are the general quetions are in DEna bank manager IT/System interviews?
Is set c++?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
What is the difference between an array and a list?
What is else if syntax?
What is the copy-and-swap idiom?
what are the decision making statements in C++? Explain if statement with an example?
Which is best c++ or java?
What is an undefined behavior and sequence points
Do you need a main function in c++?