- The polymorphic behavior
of selectionSort( )
is a result of
these mechanisms:
- selectionSort(GeometricObject)
can also so
any of its
subclasses
because
an
instance of
it subclass
(Circle or
Rectangle) is
also an
instance of
GeometricObject:
-
Subclasses
(Circle and Rectangle) can
define a
different getArea( )
than
its
superclass ---
and will cause
selectionSort( ) to
use a different
(more suitable)
getArea( )
in sorting !
|
|