#include #include class A{ public: // object for class needs vtable // for RTTI virtual ~A() { } }; using namespace std; int main() { A* a = NULL; try { cout << typeid(a).name() << endl; // Error condition } catch (bad_typeid){ cout << "Object is NULL" << endl; } try { cout << typeid(*a).name() << endl; // Error condition } catch (bad_typeid){ cout << "Object is NULL" << endl; } }