Use
RTTI to assist in program debugging by printing out the exact name of a
template using
typeid( ).
Instantiate the template for various types and see what the results are.
Implement
the function
TurnColorIfYouAreA( )
described earlier in this chapter using RTTI.
Modify
the
Instrument
hierarchy from Chapter 13 by first copying
Wind5.cpp
to a new location. Now add a
virtual
ClearSpitValve( )
function to the
Wind
class, and redefine it for all the classes inherited from
Wind.
Instantiate a
TStash
to hold
Instrument
pointers and fill it up with various types of
Instrument
objects created using
new.
Now use RTTI to move through the container looking for objects in class
Wind,
or derived from
Wind.
Call the
ClearSpitValve( )
function for these objects. Notice that it would unpleasantly confuse the
Instrument
base class if it contained a
ClearSpitValve( )
function.