samedi 9 décembre 2017

Data structure/Pattern for Person-Employee-Manager

I am working on designing an Employee/Manager structure.

  1. I have a Person Interface.
  2. The Employee class implements the Person Interface.
  3. The Manager is also an Employee and have the same restrictions like Employee.
  4. An Employee can be promoted to a Manager.

I looked in to this Design data structure for Employee-Manager but I don't like the answer provided the post. The Manager extends from Employee which means that Manager also has a promote() method which seems to break liskov-substitution.

Can someone please guide me on the correct path. Thanks.

Aucun commentaire:

Enregistrer un commentaire