כאשר RTTI מופעל,
(אם אתה עובד עם VS, יש גם אופציה שאתה צריך להפעיל ב-SETTINGS) אתה יכול לקחת את type_info על ידי קריאה ל-typeid, ואז לקרוא ל-name שהיא פונקציה שמחזירה לך את שם ה-type. הנה דוגמה מה-MSDN:
// expre_typeid_Operator.cpp // compile with: /GR /EHsc #include <iostream> #include <typeinfo.h> class Base { public: virtual void vvfunc() {} }; class Derived : public Base {}; using namespace std; void main() { Derived* pd = new Derived; Base* pb = pd; cout << typeid( pb ).name() << endl; //prints "class Base *" cout << typeid( *pb ).name() << endl; //prints "class Derived" cout << typeid( pd ).name() << endl; //prints "class Derived *" cout << typeid( *pd ).name() << endl; //prints "class Derived" delete pd; }