RTTI only works where virtual functions are involved (otherwise you already know the type). Using it requires the typeid and type_info classes. These classes use a database attached to each variable that contains the correct type. Just enabling RTTI creates this database for every variable that is a pointer (or reference) to a class with virtual functions.
For objects that don't have virtual methods, the type of the object is already known and that is what is returned by typeid. That means if you typecast a double* to an int* and do a typeid, you will get int as an answer.
Comment