State Pattern
State Pattern

State Pattern State pattern allows an object to alter its behavior when its internal state changes and the object will appear to change its class.  For explaining state pattern lets consider the example of a Turnstile at public transportation entrance for subway, where we can use our subway card so that turnstile unlocks provided there... » read more