Sealed Classes
Sealed classes are the reverse of abstract classes. While abstract classes are inherited and refined in the derived type, sealed classes cannot be inherited. A sealed class cannot be refined any further. An abstract class is "abstract" (which perhaps goes without saying), while a sealed class is concrete. You can create instances of a sealed class. Sealed classes are terminating nodes in a class hierarchy, while an abstract class is typically near the top of a class hierarchy. A sealed class is used to prevent further refinement through inheritance. For example, I am a developer of a class library. Some of the classes in the class library are extensible. However, other classes are intended to be used "as is." Those classes are marked ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access