Sealed Class in C#

Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited.

 

In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed. If a class is derived from a sealed class, compiler throws an error.

 

If you have ever noticed, structs are sealed. You cannot derive a class from a struct. 

 

http://www.c-sharpcorner.com/UploadFile/mahesh/SealedClasses11142005063733AM/SealedClasses.aspx

posted on 2010-02-05 11:07  中道学友  阅读(489)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上