简单使用
#include<iostream> #include<string> #include<new> #include<typeinfo> using namespace std; class Character { }; int main(void) { Character* pCh = new Character(); cout << "typeid(Character) == typeid(*pCh): " << (typeid(Character) == typeid(*pCh)); cin.get(); return 0; }
输出