GAMES TWO: LESSON TWENTY-THREE:
ADD PAIRS: EXTENDING BASE CLASSES

In this lesson we re-create the Add Pairs game through the extension of existing classes rather than the alteration of classes. Here are the base classes which we start with:

GENERIC_GRID class source code
GENERIC_CELL class source code

These are trully generic classes which have not been altered for the Add Pairs game. Next we extend these classes for the Add Pairs game:

AP_GRID class source code
AP_CELL class source code

Here are the rest of the pages associated with this game:

Game Directions
Game Page
Applet class source code

Discussion:

Inspect the source code carefully. Compare the AP_GRID and GENERIC_GRID classes and then do the same for the CELL classes. (The actual GENERIC_GRID and GENERIC_CELL classes used in earlier lessons where modified, but only to make them more generic.) You will notice that the applet class is almost exactly the same as it was in the last lesson. The adaptions where all made in the AP_CELL and AP_GRID classes.


ASSIGNMENT: