11.6. NotOverridable Methods and NotInheritable ClassesA 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 classthis 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 of a MustInherit class. A NotInheritable class is a concrete class that cannot act as a base class, whereas a MustInherit class is an abstract class that is intended as a base class. Class String is a NotInheritable class. Common Programming Error 11.4
|