Dynamic cast is much slower than a virtual function call. The output
from your test bears this out.
On my relatively slow computer, with -Os (our usual optimization
setting):
elapsed time: 3
elapsed time: 27
At first, I forgot to specify optimization, and I got this:
elapsed time: 14
elapsed time: 37
-- Darin