What do you mean by public, private, protected and friendly?

Answers were Sorted based on User's Feedback



What do you mean by public, private, protected and friendly?..

Answer / kumar vishal

this is access specifier which is used with member data and
member function inside a class.

Is This Answer Correct ?    6 Yes 3 No

What do you mean by public, private, protected and friendly?..

Answer / achal ubbott

public means access to the object of the class, created in
outside world.

private and protected are almost the same, except the
difference that protected members are inheritable and thus
can be used by derived class. These can be accessed only by
the public function members of the class.

Is This Answer Correct ?    2 Yes 0 No

What do you mean by public, private, protected and friendly?..

Answer / diya verma

Public : it is access modifier and also known as visibility mode.It is used to declare public members in a class.It is also used in inherit the derived class which shows public member of base class with the help of object of derived class in global scope.The public member can be accessed outside the class.

Private:It is access modifier and also known as visibility mode.It is used to accessed inside the class I.e the member of class is private.
1. All the public member will be private member of child class.
2.All the protected member will be private member of child class.
3.Private member can't be inherit.

Protected:It is access modifier and also known as visibility mode.
1.All public members will be protected member of child class.
2.All the protected member will be protected member of child class.
3.Private member can't be inherit.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

What is Agile methodology?

20 Answers   ABC, Accenture, College School Exams Tests, Inmar, Microsoft, Sapient,


what type of question are asked in thoughtworks pair programming round ?

0 Answers   Thought Works,


Please tell me the oops concept with detailed answer

9 Answers   EEE,


what is virtual function in c++

6 Answers  


Should you protect the global data in threads? Why or why not?

2 Answers   IBM,






where is memory for struct allocated? where is memory for class-object allocated? I replied for struct in stack and for class-object in heap. THen he asked if class has struct member variable what happens.class on heap and what about struct in that class? couldnt ans :( :-?

2 Answers   Infosys, Microsoft,


what is the difference between class and object?

9 Answers  


what are the different types of qualifier in java?

0 Answers   TCS,


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


What is class and example?

0 Answers  


suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?

3 Answers   EA Electronic Arts,


Can destructor be overloaded?

0 Answers  


Categories