Design Patterns
|
Chain of Responsibility
- References
- Example
-
References
-
Definition: (source: http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern)
The Chain of Responsibility pattern is a design pattern consisting of a source of command objects and a series of processing objects.
Each processing object contains logic that defines the types of command objects that it can handle;
the rest are passed to the next processing object in the chain.
-
Example
-
The
Object
:
-
The
Abstract Handler
:
-
The
Concrete Handler
(1):
-
The
Concrete Handler
(2):
-
A simple class to test the
Chain of Responsibility
design pattern: