Run Time Type Identification
student* ps = new student;
if (typeid(*ps) == typeid(account))
  cout <<"*ps is an account object" <<endl;
if (typeid(*ps) == typeid(checking))
  cout <<"*ps is a checking object" <<endl;
if (typeid(*ps) == typeid(student))
  cout <<"*ps is a student object" <<endl;
if (typeid(*ps) == typeid(savings))
  cout <<"*ps is a savings object" <<endl;
The typeid operator is used to check the type of an object
against a known type whereas the dynamic_cast operator
can be used to check the type of an object against an entire
hierarchy.