The composite design pattern allows us to create an object tree structure. We can then treat both objects and the tree structures in the same manner, as individual objects. Without this design pattern, we can run into problems when we create structures from multiple objects. The problems stem from the need to treat primitive objects and the composite differently. The composite design pattern was created to overcome the aforementioned problem.
In order to implement the composite design pattern, we first create an abstract class to represent the primitive and tree structures.