c++ typeid

时间:2021-06-05 09:00:14

简单使用

#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 ;
}

输出

c++ typeid