What are the differences between public, private, and
protected access?

Answers were Sorted based on User's Feedback



What are the differences between public, private, and protected access?..

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

What are the differences between public, private, and protected access?..

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

Post New Answer

More C++ General Interview Questions

How do I run c++?

0 Answers  


What is an ABC: an "Abstract Base Class"?

1 Answers  


Is there any difference between int [] a and int a [] in c++?

0 Answers  


What do you mean by a template?

0 Answers  


What is c++ programming language?

0 Answers  






What is set in c++?

0 Answers  


What's the most powerful programming language?

0 Answers  


Explain method of creating object in C++ ?

0 Answers   Wipro,


What is the average salary of a c++ programmer?

0 Answers  


What is the difference between public, private, protected inheritance?

12 Answers   Wipro,


Write a C++ Program to Generate Random Numbers between 0 and 100

1 Answers  


In which memory a class gets stored(in heap /in stack)? And why??

2 Answers  


Categories