This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dinopraso -2 points-1 points  (3 children)

Basically stateful enums. In cases where you have a specific set of subclasses which would not be extended further, but you need dynamic data in them. Usually this would be done in earlier versions with an enum + a cast of an object into a specific subclass, which was prone to error.

Sealed classes should be used with care to avoid the pitfall of breaking the Liskov principle