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 |
i want the NIC programmer-B model papaer pattren, iwant the all model papers?
How would you represent an error detected during constructor of an object?
Is c++ pass by reference or value?
What is an inline function in c++?
What is type of 'this' pointer? Explain when it is get created?
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
what are Access specifiers in C++ class? What are the types?
What is class and structure in c++?
What is the default access level?
Why is c++ still used?
Is atoi safe?
What is an incomplete type in c++?