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 |
Is nan a c++?
Explain the difference between new() and malloc() in c++?
Where are setjmp and longjmp used in c++?
int *p = NULL; printf("%1d",p) ; what will be the output of this above code?
Is there a c++ certification?
What is difference c and c++?
How we can differentiate between a pre and post increment operators during overloading?
What is fixed in c++?
What is a modifier in c++?
What is stack unwinding?
Explain Memory Allocation in C/C++ ?
Is overriding possible in c++?