What do you mean by public, private, protected and friendly?
Answer Posted / 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 View All Answers
What is overriding in oop?
What is basic concept of oop?
What is the fundamental idea of oop?
what is the drawback of classical methods in oops?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
What is difference between inheritance and polymorphism?
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
What is abstraction and encapsulation?
Can you inherit a private class?
What are the three main types of variables?
Write a c++ program to display pass and fail for three student using static member function
Can we create object of interface?
Why multiple inheritance is not possible?
What is encapsulation with real life example?
What is data binding in oops?