NotInheritable in VB.NET

This article demonstrates how to create sealed classes in VB.NET.
  • 5838

A NotInheritable class (known as a Sealed class in C#) is a class that cannot be inherited from other classes. The sole purpose of this class to provide some implementation that can be used within that class only.  These types of classes are usually used by component and library developers to restrict inheritance of their classes.

Here is the syntax of a NotInheritable class.

NotInheritable Class Monkey

 

End Class

If you derive a class from Monkey class, you will get the following error.

NI1.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.