UML class diagram - can aggregated object be part of two aggregated classes?
Posted
by
user970696
on Programmers
See other posts from Programmers
or by user970696
Published on 2013-11-01T11:55:16Z
Indexed on
2013/11/01
16:20 UTC
Read the original article
Hit count: 365
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
© Programmers or respective owner