What are the differences between public, private, and
protected access?
Answers were Sorted based on User's Feedback
Answer / koushik k reddy
Private:
It cannot be accessed by object and cannot be inherited, will be used only by the member functions of the class
Protected:
It cannot be accessed by the object and used by the member functions of the class can be inherited to first level of inheritance
Public:
It can be accessed by the objects and can be inherited to any level
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kalpana.y
Private is used for intialization of variables
eg:
int p,r;
public is used for function name
eg:
void display();
protected is used for void main()
eg:
void main()
class c;
| Is This Answer Correct ? | 24 Yes | 86 No |
When do you call copy constructors?
what is the basic concept of c++(object oriented programing)
How to stop conversions among objects?
Write any small program that will compile in "C" but not in "C++"?
Explain the difference between c++ and java.
What is a virtual destructor? Explain the use of it?
Difference between an inspector and a mutator
What is encapsulation in c++?
Why do we need c++?
What is the difference between the functions memmove() and memcpy()?
What is the use of lambda in c++?
In a class only declaration of the function is there but defintion is not there then what is that function?