Monday, July 18, 2005

My Classes Are Sealed

Continuing the theme tonight of talking about new C# keywords and language implementations (and comparing them to Java), I would be remiss if I didn't mention the keyword "sealed."

By marking a class "sealed" you prevent other classes from deriving from it. A sealed class, then, is sort of a one off. In contrast, you could also mark a class abstract (just like in Java -- behaves the same way too), which means that the class is made to be derived and cannot be instantiated itself.

No comments: