c++ typeid

简单使用

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

输出

原文地址:https://www.cnblogs.com/heben/p/9527990.html