Reputation: 11
I have a class named Employee.This class have 3 attributes:name,adress and supervisor.
Upvotes: 0
Views: 89
Reputation: 47068
If the supervisor of an Employee can be any other kind of Employee
the supervisor should be an Employee
, but if only Managers can be supervisors then supervisor should be Manager
.
Just as a side note: Inheriting in this way is not always a good solution. You will run into lots of trouble if Employee
can have multiple roles, like both Developer
and Designer
.
I recommend you to have a look at object composition instead of inheritance.
Upvotes: 1