Friday, December 28, 2007

OOP: VB.Net Polymorphism

Continuing further with the inheritance discussion, VB.net also enables polymorphism when a class is derived from a base class.

Poloymorphism is accomplished with the following keywords. Designating an instance or base class with these keywords make the code easier to understand:
  • Overloads - Allows a method to be described using different signatures (or combinations of parameters), however keeping the same name.
  • Overridable - Used when creating a property or method in the base class which will allow the derived class to change its function
  • Overrides - Used by the derived class to manipulate a method in the base class.
  • NotOverridable - Used when creating a property or method in the base class which will not allow overriding.
  • MustOverride - Used when creating a property or method in the base class which must be overridden.

No comments: