More Patterns (cont.)

Pattern Name Description Example
Factory Method A virtual constructor can be redefined by derived classes Collection classes that derive from a common base class redefine the create_iterator function
Flyweight Uses shared objects instead of large numbers of separate objects with identical state A word processor uses shared objects for styled characters rather than a separate object for each character
Interpreter A class hierarchy represents grammar rules. The interpreter recursively evaluates a parse tree of rule objects A program interactively evaluates mathematical expressions by building and evaluating a parse tree

prev |top |next