Rtti is implementation specific but I will try to discuss an approach:
Every object (with rtti support) has a pointer.
This pointer, points an array of virtual function pointers of the class. The vtable. There is one vtable per class (not per object).
Ιf you want rtti it is only one pointer comparision:
1 2 3
if (object1.vtable_pointer == object2.vtable_pointer) is_the_same_class();
// or
if (object1.vtable_pointer == Class::vtable_pointer) is_the_same_class();