One-to-many and aggregation

I am having difficulty in undersand the difference between one-to-many association between two classes aggregation relationship betweeen two classes. Are they same? Can they overlap?

thanks

Hi pradeep,

Thanks for your post. In fact, they are not the same.
One-to-many association does not specify the characteristics of the relationship while aggregation does.
Aggregation is the part-of relationship. It’s like saying that a car has an engine and wheels as its part.

I hope this explanation can help. If you have any further inquiries, please feel free to ask.

Best regards,
Lilian Wong

Hi Wong,

If I have understood you well, then it means that if a PERSON has one-to many relationship with ADDRESS then, a PERSON’s characteristic is not defined or identified by ADDRESS. So A PERSON is not an aggregation of ADDRESS while a PERSON has one-to-many relationship with ADDRESS.

Thanks for the explanation. :slight_smile:

-pradeep

Hi pradeep,

Actually, aggregation specifies the characteristics of the relationship between two classes, but it is not necessary to be one-to-many relationship.

Will it be more clear? If there are any inquiries, please feel free to ask.

Best regards,
Lilian Wong

Hi pradeep,

The easiest way to remember aggregation ist, that it shows "has-a " relationship. It can be one-one, one-many or any other relationships.

Assiziation just defines, that classes have relationship.

I hope it will help.