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
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
What is difference between data abstraction and encapsulation?
What are the features of oop?
What does and I oop mean?
What is abstraction and encapsulation?
What is overriding in oops?
What does and I oop mean in text?
What language is oop?
What is destructor give example?
What is use of overloading?
What is polymorphism and example?
What is abstract class in oop?
what is the sylabus for priliminaries?
What is overriding vs overloading?
write string class as your own class in java without using any built-in function