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 |
Comment on local and global scope of a variable.
Define precondition and post-condition to a member function?
what is difference between internet and Internet?
12 Answers College School Exams Tests, Microsoft, MIT, TCS,
What are the main characteristics of C++ as a programming language?
What is c++ hash?
Explain virtual class?
What you know about structures in C++?
0 Answers Agilent, ZS Associates,
What are the four partitions in which c++ compiler divides the ram?
what is pulse code modulation?
What is flush () in c++?
What is the main purpose of overloading operators?
Is java made in c++?