- An object's behavior change is represented by its member classes, which share the same super class.
Where to use ?
- Need to control many states without using if-else or switch statements.
- Use a class to represent a state, not a constant or something else.
- Every state has to act in a similar manner.
- Every state must be a subclass of the same super class.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.