 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Whenever
we want a function to be dynamically bound,
|
|
|
we
should define that function as virtual in a direct or
|
|
|
indirect
base class.
|
|
|
| • |
By
doing so, we are turning on the dynamic binding
|
|
|
mechanism
and allowing member functions to be selected
|
|
|
at
run time based on the type of object pointed or referred
|
|
|
to.
|
|
|
| • |
Virtual
functions should be used when we want to provide
|
|
|
member
functions in our base class that define an interface
|
|
|
for
application programs to use.
|
|
|
| • |
The
actual implementation of the virtual functions is either
|
|
provided
by the base class or is overridden and
|
|
|
implemented
as appropriate in derived classes.
|
|