UML class diagram - can aggregated object be part of two aggregated classes?
- by user970696
Some sources say that aggregation means that the class owns the object and shares reference. Lets assume an example where a company class holds a list of cars but departments of that company has list of cars used by them.
class Department
{
list<Car> listOfCars;
}
class Company
{
list<Car> listOfCars;
//initialization of the list
}
So in UML class diagram, I would do it like this. But I assume this is not allowed because it would imply that both company and department own the objects..
[COMPANY]<>------[CAR]
[DEPARTMENT]<>---| //imagine this goes up to the car class