Ask Question
5 November, 19:40

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

+3
Answers (1)
  1. 5 November, 19:44
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers