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.
- How to: Create Derived Classes
Steps you through the process of creating derived classes.
- When to Use Inheritance
Discusses when to use inheritance instead of interfaces.
- Inheritance and the .NET Framework
Explains how the .NET Framework supports inheritance.
- Walkthrough: Implementing Inheritance with COM Objects
Describes using existing COM objects as the basis for new objects.
- Inheritance and the Base Object Class
Provides an overview of the class that serves as the basis for all other classes.
- How New and Finalize Methods Work in a Class Hierarchy
Describes how constructors and destructors are called in a class hierarchy.
- Polymorphism
Summarizes polymorphism and how it is used.
- Designing an Inheritance Hierarchy
Provides information about designing and implementing a class hierarchy.
Related Sections
- Interfaces in Visual Basic
Summarizes what interfaces are and how they are used.
- Object-Oriented Programming in Visual Basic
Introduces the concepts of object-oriented programming as they are used in Visual Basic.