Composite

Origin: GoF 95
Reason: A structured object is recursively defined in terms of other objects.
Synopsis: Define an interface common to a family of objects. Build objects in a tree-like structure whose nodes are objects of the family.
Example: A document is made by elements such as pages, lines, etc., and embedded or nested documents.
Solution:
AbstractComponent Superclass of the entire family of objects in the composite structure. DocumentElement
ConcreteComponent Implementations of AbstractComponent, the leaves of the tree-like structure. Page, Line
AbstractComposite Superclass of the properly composite objects in the composite structure. Document
ConcreteComposite Implementations of AbstractComposite, the branches of the tree-like structure. WordDocument, Spreadsheet
See also: Visitor