Pattern: Handle Body


Context

Separate an abstraction from its implementation.

Solution

Keep the abstraction separate from its implementation, by creating one hierarchy for the abstraction and one for the implementation.

Create an abstract class which defines the protocol of the implementation layer. Create concrete subclasses of that class for each implementation.

Instances of the abstraction class contain a reference to an instance of one of the implementation concrete subclasses. The abstraction layer is coded in terms of the implementation layer.

Example

Consequences

Known Uses

Related Patterns