 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Java,
like C++, has some rules to get dynamic binding to
|
|
|
work
for us
|
|
|
– |
The
methods must be defined in the base class (to which we use a
|
|
reference
to) and they must be anything BUT private (public,
|
|
|
protected,
or “friendly” are all ok)
|
|
|
– |
We
must invoke the function thru a reference to the base class,
|
|
|
but
have it refer to an object of the proper class to which we are
|
|
|
interested
|
|
|
– |
The
argument lists, function names, and return types must be
|
|
|
identical
|
|
|
– |
The
only difference is we don’t need the “virtual” keyword (that
|
|
|
was
C++)
|
|