Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

Unsealed Classes

An unsealed class allows other classes to inherit from it. Many of the other extensibility mechanisms, such as protected and virtual members, require that a class be unsealed. These additional mechanisms add powerful ways to add to or customize a type's functionality, but not without a significant cost. An unsealed class can be useful in many development scenarios, even without the additional extensibility mechanisms.

Consider unsealed classes with no virtual or protected members as a great way to provide inexpensive, yet much appreciated, extensibility to a framework.

By default, most classes should not be sealed. This allows developers to customize classes based on their specific scenarios. For example, when a class is unsealed a developer can add a constructor to a type derived from the class, and use that constructor to initialize the base class properties to the values required for the scenario. The developer can also add method overloads that pass scenario-specific default values.

Portions Copyright 2005 Microsoft Corporation. All rights reserved.

Portions Copyright Addison-Wesley Corporation. All rights reserved.

For more information on design guidelines, see the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams, published by Addison-Wesley, 2005.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.