11.6. NotOverridable Methods and NotInheritable Classes

A method that is declared NotOverridable in a base class cannot be overridden in a derived class. A method that is declared Overridable in a base class can be declared Not-Overridable in a derived class—this prevents overriding the method in classes that inherit from the derived class. All classes derived from the class that contains the NotOverridable method use that class’s method implementation. Methods that are declared Private are implicitly NotOverridable.

A class that is declared NotInheritable cannot be a base class (i.e., a class cannot inherit from a NotInheritable class). All methods in a NotInheritable class are implicitly NotOverridable. A NotInheritable class is the opposite ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.