Sealed Class

Noun · Development

Definitions

  1. A class that restricts which other classes can inherit from it, typically requiring all subclasses to be defined in the same file or module, enabling exhaustive pattern matching.

    In plain English: A special kind of class where you list every possible subtype up front, so the compiler can tell you if you forgot to handle one.

    Example: "Using a sealed class for our API result means the compiler checks we handle Success, Error, and Loading."

Related Terms