Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition
by Paul J. Deitel - Deitel & Associates, Inc., Harvey M. Deitel - Deitel & Associates, Inc.
11.1. Introduction
We now continue our study of object-oriented programming by explaining and demonstrating polymorphism with inheritance hierarchies. Polymorphism enables us to “program in the general” rather than “program in the specific.” In particular, polymorphism enables us to write programs that process objects that share the same base class in a class hierarchy as simply as if they were all objects of the base class. Yet, as we send method calls in this general way, the specific objects “do the right thing.”
Consider the following example of polymorphism. Suppose we create a program that simulates the movement of several types of animals for a biological study. Classes Fish, Frog and Bird represent the three types of animals under investigation. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access