 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Inheritance
is the way to model this “subset” relationship.
|
|
|
| • |
A
class, called a subclass or derived class inherits from a
class (a
|
|
|
|
superclass,
parent, or base class), if its objects form a subset of the
|
|
base
class objects
|
|
|
| • |
The
objects in the subclass must support all operations that are
|
|
|
supported
by the superclass, but they may carry out these
|
|
|
|
operations
in a special way.
|
|
|
| • |
They
may also support additional operations
|
|
|
| • |
Think
about bank accounts – do checking and savings accounts
|
|
|
|
differ
in any way? Are they separate classes or instances of the
|
|
|
same
class? Is there anything common between them?
|
|