Polymorphism and Type Substitution

In the first part of this chapter, inheritance was presented as an effective way to reuse the implementation details of a base class across many derived classes. While reuse of implementations is valuable, another aspect of inheritance is equally important—its support for polymorphic programming.

Polymorphism

Every derived class inherits the programming contract that is defined by the public members of its base class. As a result, you can program against any object created from a derived class by using the same programming contract that's defined by the base class. In other words, inheritance provides the ability to program against different types of objects using a single programming contract. This polymorphic ...

Get Building Applications and Components with Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.