Back to Developer Roadmap

Sealed traits

src/data/roadmaps/scala/content/[email protected]

4.0564 B
Original Source

Sealed traits

Sealed traits are used to define closed hierarchies where all possible subclasses are known. They can be extended only in the same file as their declaration, allowing the compiler to perform exhaustiveness checking. This feature is particularly useful for pattern matching.

Visit the following resources to learn more: