next up previous
Next: About this document ...

1#1
1#1
Introduction to
Object Oriented Programming 2E
Timothy A. Budd
1#1
Chapter 6
1#1
Case Study: A Billiards Game

Purpose of Chapter

The purpose of this chapter is to once again illustrate the design of a program as a universe of interacting agents working together to produce the desired outcome.

Picture of Billiards Table


2#2

Graphical Object Class

Every graphical object has a link field and a region of space.


3#3

Objects must be initialized


4#4

Graphical Objects can Draw themselves


5#5

Objects can be Hit


6#6

Balls move when updated


7#7

Reaction to Mouse Down Events


8#8

Using Inheritance

The program can be greatly simplfied by making all graphical objects inherit from a common base class.

We will have much more to say about inheritance, and the power that comes from the use of inheritance, in subsequent chapters.



 

ChandraKanth Modem
1/27/1999