In the original C++ design, Bjarne Stroustrup did not include run-time type information, because he thought this mechanism was often misused.
Using these flags may reduce the overall size of the application, making them especially useful when targeting systems with a limited amount of memory.
[citation needed] Some aspects of the returned object are implementation-defined, such as std::type_info::name(), and cannot be relied on across compilers to be consistent.
Objects of class std::bad_typeid are thrown when the expression for typeid is the result of applying the unary * operator on a null pointer.
Console output: A similar version of MyFunction can be written with pointers instead of references: In Object Pascal and Delphi, the operator is is used to check the type of a class at runtime.
The following example shows the use of the RTTI module to obtain information about the class to which an object belongs, creating it, and to call its method.