This pattern is used to change the behavior of an object when its internal state changes. Here, an object is built to represent several states, as well as a context object whose behavior changes as its state object does.
Examples of the state design pattern include
The classes, interfaces, and objects in the above UML class diagram are defined as follows.
The Strategy design pattern is applicable in the following scenarios: