The Composite Pattern defines a pattern with a class which is made to have children classes. It involves four classes: “Client”, “Component”, “Leaf” and “Composite”. The “Component” is the class which receives the call from the “Client”. The “Component” class have two different children classes, one which does not have any children of its own – The “Leaf” class, and the other which inherits the methods to hold children of its own – The “Composite” Class.
When looking at the composite pattern, it can easily be compared to a family tree with children and parents. The children in the family tree can have children of their own, like the Composite class. Or they can be the last line of their branch, like the Leaf class.