Defining Classes That Must Be Subclassed

A class that cannot be instantiated and must be inherited is referred to generically as a virtual abstract class. Such classes in Visual Basic .NET are indicated by the presence of the MustInherit class modifier.

Virtual abstract classes were defined in C++ before COM interfaces. Virtual abstract classes are the closest thing to pure COM interfaces. When you define a class with the MustInherit modifier, you are communicating to consumers that all child classes of the virtual abstract class must implement all of the members marked with the MustOverride modifier in the parent class. If a child only implements some of the virtual abstract members in the parent, the child also is virtual and abstract.

MustInherit ...

Get Visual Basic® .NET Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.