Aggregation is when an object is made up of one or more objects, but those objects can live outside the main object. It defines the has-a relationship.
Note: In the aggregation, if main object is destroyed, its aggregated objects may still live.
Example #1: A Library
is an aggregation of Books
. Books can live without the library.
Example #2: A Department
is an aggregation of Employees
. If department closes, the Employees can exist on their own.