Search code examples
classdiagramdesign-decisions

Class Diagram with aggregation and generalization


I am working on a university project and i have the following problem i can not figure out.

I have a class Called Employee from this i generalize two classes Contractor employee and Permanent Employee.

Now i have a team that is made by both types of Employee so i am planning to use aggregation.

Do i have to connect the team class to the two subclasses or to the employee class?

Thanks


Solution

  • To the employee class. The team class will have a list of Employees; it won't care it they're actually ContractorEmployees, PermanentEmployees, or FooEmployees.