Why use RTTI?
We have virtual functions in a base class, and those would seem to be able to handle the polymorphic distinction between the object type.
So why would we use RTTI?
When we want to act through a pointer or reference to a base function, but cannot use virtual functions.
Why couldn’t we use virtual functions?
We could but it would be awkward ... an example will help.
In a previous set of notes we talked about the idea of not wanting to have to go back and make changes to a base class based on specialisations of it, and that’s what we would need to do here. Virtual functions need to have the same parameter set across the class hierarchy, but that doesn’t always make sense.
We might reach a specialisation where an additional parameter is needed, and going back to modify the original and intermediate classes isn’t ideal, nor is adding another virtual function with a different signature.