Context:

Objects of a type family are covariantlly associated one-to-many with objects of a parallel type family (e.g. editors and edited documents).

Challenge:

to encapsulate the fact of association and its management in the abstract base class, still, allowing a derived-class to limit the contained population safely.

Skill:

Participants:

Container:

Contains the heterogeneous collection and features the generic access sub-interface.

Concrete Container:

Uses the heterogeneous collection in part of its capacity. Responsible for performing significant operations on the objects inside, depending on their true type.

Resource:

The declared content of the collection. A passive participant. Optionally, features a "fat" interface.

Concrete Resource:

The actual content of the collection, in a concrete container. The Concrete Container optionally downcasts each Resource into a Concrete Resource before applying particular operations.

Signature:

Container contains (or references) Resources. Concrete Container specializes in Concrete Resources (but does not contain them directly). 

Used patterns and idioms:

Optionally - Template Method.

Used by:

Composite pattern, observer (GOF), general-purpose editors.

Scope:

General.