UML Association, Aggregation, and Composition

There are three kinds of associations between two classes in UML notation.

Association:
One to one relationship.
Examples
-Object A is associated with one object B.
-One key is associated with one lock.

Aggregation:
One to many relationship.
Examples
-Object A is associated with many object Bs, but object A can also be associated with many object Cs at the same time.
-One student has many teachers.

Composition:
It is a special kind of aggregation (One to many relationship) but implies one object is made up of many of another objects.
Examples
-Object A is composed of many object Bs, when object A is destroyed, all object Bs are destroyed along with it.
-One house is composed of many rooms

This entry was posted in uml. Bookmark the permalink.