Intent
This has a set of behaviours encapsulated in state objects; at any time the context is delegating to one of those states. The client usually knows very little, if anything about the state objects.
This has a set of behaviours encapsulated in state objects; at any time the context is delegating to one of those states. The client usually knows very little, if anything about the state objects.
Why is this used?
Allows the object to alter its behaviour when its internal state changes. The object will appear to change its class.
Allows the object to alter its behaviour when its internal state changes. The object will appear to change its class.
Source code example
https://www.tutorialspoint.com/design_pattern/state_pattern.htm
More to follow...
No comments:
Post a Comment