SE450: Subclassing: Delgation versus Subclassing [4/35] Previous pageContentsNext page

Read the following diagram as ``every instance of Counter has a reference to an instance of Subscriptions.''

   +------------+       1 +---------------+
   | Counter    |<>-----> | Subscriptions |
   +------------+         +---------------+

Subclassing defines a single object incrementally.
In JAVA, says that subclass interface extends superclass interface.

Read the following diagram as ``every instance of Counter is also an instance of Observable.''

   +------------+         +------------+
   | Counter    |- - - -|>| Observable |
   +------------+         +------------+

At run time, objects have references to the objects they know about. This is the object graph or heap.

At compile time, classes are related via subclassing and subtyping (as well as other dependencies). This is the class hierarchy.

Previous pageContentsNext page