How Visual Basic Provides Polymorphism

Traditionally, polymorphism in Visual Basic was done by using interfaces, and interfaces can still be used for this purpose. However, now Visual Basic provides the option of using inheritance to provide polymorphism.

As with other issues in object-oriented programming, the option to use depends on your specific requirements. In general, use inheritance when you want to create baseline functionality that derived classes can extend; use interfaces when similar functionality has to be provided by multiple implementations that have little in common.

See Also

Concepts

Inheritance-Based Polymorphism

Interface-Based Polymorphism

Other Resources

Designing an Inheritance Hierarchy