Composite Pattern
Context
- Primitive objects can be combined to composite objects
- Clients treat a composite object as a primitive object
Solution
- Define an interface type that is an abstraction for the primitive
objects
- Composite object collects primitive objects
- Composite and primitive classes implement same interface type.
- When implementing a method from the interface type, the composite
class applies the method to its primitive objects and combines the
results