Inheritance definedTopSome Mysteries of objectdraw, ExplainedDescribing similar things

Describing similar things

The class we "extend" is the class that we are like. The constants, variables, and methods that we define indicate how the new class differs from the one that we are extending.

We have done this all semester to create WindowControllers and ActiveObjects. For example, consider the header

public class Fall extends WindowController

from our falling leaves example. Fall is a WindowController. It has the same behaviors and properties as other WindowControllers, except for the things that we specify: 1) how it it draws the display (defined in the begin method) and 2) how it responds to mouse clicks (creating a tree from which leaves fall).

Here, we call Fall the subclass and WindowController the superclass.


Inheritance definedTopSome Mysteries of objectdraw, ExplainedDescribing similar things