I have a class named Employee.This class have 3 attributes:name,adress and supervisor.
I have a class named Employee.This class have 3 attributes:name,adress and supervisor.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the supervisor of an Employee can be any other kind of
Employeethe supervisor should be anEmployee, but if only Managers can be supervisors then supervisor should beManager.Just as a side note: Inheriting in this way is not always a good solution. You will run into lots of trouble if
Employeecan have multiple roles, like bothDeveloperandDesigner.I recommend you to have a look at object composition instead of inheritance.