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
Is rust better than c++?
What are single and multiple inheritances in c++?
Write about the retrieval of n number of objects during the process of delete[]p?
What is meaning of in c++?
What is istream c++?
How can you link a c program with a c function?
Is c++ a high level language?
What is the difference between global variables and static varables?
How can a called function determine the number of arguments that have been passed to it?
What is iterator c++?
How many ways can a variable be initialized into in C++?
What are the various access specifiers in c++?
Write a function to find the nth item from the end of a linked list in a single pass.
What parameter does the constructor to an ofstream object take?
Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].