What is State pattern?
- A design pattern in which an object, called the composite, is composed of one-to-many other objects, in a tree-like structure, allowing the client to interact with individual objects and compositions of objects uniformly
- A design pattern in which an object, called the context, holds a reference to an instance of one of several possible concrete state objects, each of which represents a distinct state of the context and implements a common state interface
- A design pattern in which an object, called the decorator, adds or overrides behavior of an existing object, dynamically
- A design pattern in which an object, called the prototype, is used as a template to create new objects, without specifying their concrete classes
The State pattern is a design pattern in which an object, called the context, holds a reference to an instance of one of several possible concrete state objects, each of which represents a distinct state of the context and implements a common state interface. The State pattern allows the context's behavior to be altered dynamically by changing its state. The State pattern is used to implement state machines, allowing an object's behavior to be altered as its internal state changes.
Loading...