Introduction
Sealed classes help you group related types in one place and control which classes can extend them. This makes your code safer and easier to understand.
When you want to represent a fixed set of types, like different states of a process.
When you want the compiler to check that you handle all possible cases in a when expression.
When you want to restrict class inheritance to a known set of subclasses.
When modeling choices or options that don't change often.
When you want clearer and safer code for handling different types of results.