Ask Question
14 January, 03:51

What is the relationship between the Employee class and the Manager class? What concept does this demonstrate

+3
Answers (1)
  1. 14 January, 07:27
    0
    Here, The Manager class is a child class of Employee class. There is an "Is-A" relationship between the manager and employee classes. Here Manager class extends from Employee class. That means Manager "is an" Employee.

    It means Manager class objects will have the fields of the Employee class but it cannot access them on its own as my Name, my Title and my Age are declared private. It has to use super keyword and super class methods and constructors to access those fields. But, Manager class can access mySalary on its own because it is declared protected. As a sub class object can call super class methods (which are public and protected), the sub class objects can access those field indirectly by using super class constructors and methods. It means the Manager class cannot directly control the Employee class fields without using Employee class constructors and methods.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is the relationship between the Employee class and the Manager class? What concept does this demonstrate ...” in 📘 Business if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers