Aggregation
In this section, we study aggregation.
Concept
Aggregation is also called composition. It is a way to relate multiple classes.Basically, data members of a class are objects of other classes.
The relationship between these objects is “has-a” relation.
Examples
A vehicle has a brake and a steering wheel.
An employee has a department.
A course has a teacher, book, and student list.
A Vehicle object has a Brake object and a Steering Wheel
object as data members.
An employee has a department.
An Employee object has a Department object as the member.
A course has a teacher, book, and student list.
A Course object has a teacher object, Book object,
and Student List object as data members.