OOPS Concepts: Association, Aggregation and Composition

With Object Oriented Programming, we aim for better and easy representation of real world objects. Above oops concepts define relationship between two objects.  These relationship define basic functionality which constitutes to OOPS.


It defines that one object has reference of the other. In other words, we can say relationship between two classes defined by their objects. Associativity could be of type one to one, one to many, many to one or many to many.

Above example, we define address of an Employee using Address class object. It defines Aggregation between Employee and Address. In other words, Employee HAS-A Address. This kind of relationship is called HAS A relationship.


Composition is a special type of Aggregation. Unlike Aggregation, It is more of a restrictive relationship between two classes.  If composition of an Object A contains another Object B then if A does not exist, B can not have it’s existence.

In above example, A Company contains number of Employee, Employee can not exist if there is no Company. This relationship is a Composition between Company and Employee.

You may also like...