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
Can c++ be faster than c?
Can a class be static in c++?
Which compiler does turbo c++ use?
Is linux written in c or c++?
What is the use of setprecision in c++?
What does std :: flush do?
How is new() different from malloc()?
What is singleton class in c++?
Does improper inheritance have a potential to wreck a project?
Explain explicit container.
Write a c program for binary addition of two 8 bit numbers.
Does c++ support exception handling?
Can you use the function fprintf() to display the output on the screen?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
Write a program in c++ to print the numbers from n to n2 except 5 and its multiples