Inheritance/Polymorphism  «Prev 

C++ typeid() Pointer Argument

If the typeid() argument is a base class pointer, while the object is of a type derived from that base class, a reference for the derived class is the result. The argument must be a pointer to the base class with virtual functions. Otherwise, the result is the type_info of the base class. The pointer must be dereferenced so that the object it points to is used. Without dereferencing the pointer, the result will be the type_info for the pointer, not what it points to.

typeid allows to check the type of an expression:
typeid (expression)

This operator returns a reference to a constant object of type type_info that is defined in the standard header file < typeinfo > . This returned value can be compared with another one using operators == and != or can serve to obtain a null-terminated character sequence representing the data type or class name by using its name() member.