The typeid operator

We saw this briefly in S2d. The typeid operator can be used to identify the actual type of an object obtaining this information from RTTI., if it’s attached as it wil be in a polymorphic type. To use this we need the header <typeinfo>. The typeid operator returns a reference to an object in the system class type_info that describes a type.

  • Dynamic type for polymorphic objects.

  • Static type for others.

    • This is what we saw earlier, there is no RTTI available.