Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The State Pattern allows a complex system to be implemented in a structured way. The overall behaviour of a system is partitioned into well-defined states. Typically, each state is implemented by a class. The overall system behaviour can be determined firstly by knowing what state it is 'in'; secondly, by the behaviour embodied in the methods of the class corresponding to that state.

Example

Here is an example:

Here is the output:

  • No labels