 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
This
cost is not as bad as it first seems. Many compilers do
|
|
this
more efficiently.
|
|
|
| • |
Second,
to “simulate” dynamic binding, the application
|
|
|
would
be implemented significantly differently. Each
|
|
|
derived
class would have to define a value to represent its
|
|
|
type
so that the application could query the object at run
|
|
|
time
to determine what type it was pointing to. Then, the
|
|
|
application
would have to downcast the pointer from an
|
|
|
account
object to the correct type in order to access the
|
|
|
correct
derived class member function. This would have to
|
|
|
be
done each time a derived class member function needed
|
|
|
to be
accessed.
|
|