Seems very similar, except the special case is usually used for replacing null values as a starting point.
When used to expose polymophic behaviors, the state pattern uses a "container" class to hold the state using composition, but the special case classes use sub-typing (thus the need for a factory of some kind).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This feels a lot like the state pattern to me. How is it different?
Seems very similar, except the special case is usually used for replacing
null
values as a starting point.When used to expose polymophic behaviors, the state pattern uses a "container" class to hold the state using composition, but the special case classes use sub-typing (thus the need for a factory of some kind).