Overriding Properties and Methods in Derived classes


By Defualt, a derived class inherits methods from its base class.If an inherited property

or method needs to behave differently in the derived class it can be overridden; that is,

you can define a new implementation of the method in the derived class.

The following modifiers are used to control how properties and methods are overridden:


*Overridable:-

Allows a property or method in a class to be overridden in a derived class.

*Overrides:-

Overrides an Overridable property or method defined in the base class.

*NotOverridable:-

Prevents a property or method from being overridden in an inheriting class.

Public methods are NotOverridable by defualt.

*MustOverride:-

Requires that a derived class override the property or method.When the

MustOverride keyword is used, the method definition consists of just

the Sub,Function ,or Property statement. No other statementsare allowed,

are specifically there is no End Sub or End Function statement.

MustOverride methods must be declared in MustInherit classes.


Average Rating (0)
by hetal   more  in VB.Net  on 3/24/2015 10:49:15 PM  


Post Your Comment
*