Using Inheritance

Although we won't talk about inheritance until chapter 7, we do note that this program could have been simplified by using inheritance. If we had inherited Balls, Walls and Holes from a common parent class, say Graphical Object, then we could easily have reduced the three loops in an earlier slide into a single loop. This would have made the program both shorter and more robust.

We will have much more to say about inheritance, and the power it provides, in subsequent chapters.

[audio] [real] Text to accompany slide10, in Chapter 6 of An Introduction to Object-Oriented Programming