共用方式為


Inheritance in Visual Basic 

Visual Basic supports inheritance, the ability to define classes that serve as the basis for derived classes. Derived classes inherit, and can extend, the properties, methods, and events of the base class. Derived classes can also override inherited methods with new implementations. All classes created with Visual Basic are inheritable by default.

Inheritance allows you to write and debug a class once, and then reuse that code over and over as the basis of new classes. Inheritance also allows you to use inheritance-based polymorphism, the ability to define classes that can be used interchangeably by client code at run time, but with functionally different, yet identically named methods or properties.

In This Section

  • Inheritance Basics
    Covers inheritance modifiers, overriding methods and properties, MyClass, and MyBase.