You will learn the following in this chapter:
Recall from Chapter 2, "The Basics of Object-Oriented Programming," that the three basic building blocks of object-oriented programming (OOP) are encapsulation, inheritance, and polymorphism. This chapter examines the third component of the OOP trilogy: polymorphism. You will learn what polymorphism is and how to take advantage of it in your programs. By the end of this chapter you will know how to use polymorphism to increase the flexibility of classes, reduce the amount of code required for a given program, and make programs easier to debug and maintain. This chapter ends by showing you how interfaces relate to polymorphism and OOP in general.