Benefits of Inheritance

The table on this slide illustrates one of the most important benefits of the use of inheritance in this application. With five different classes and five different methods, there are 25 potential methods that we might have to define. By making use of inheritance, and inheriting the default behavior from the parent class CardPile, there are only 13 methods that we actually implement. Furthermore, we are guaranteed that each pile will respond in the same way to similar requests.

[audio]a [real]a Text to accompany slide15a, in Chapter 8 of An Introduction to Object-Oriented Programming