和答案一樣通過(guò)不了
/474/9251/BqNL/index.cpp: In function 'void doSomething(Movable*)':
/474/9251/BqNL/index.cpp:62:16: error: must #includebefore using typeid
? ? if(typeid(*obj)==typeid(Bus))
? ? ? ? ? ? ? ?^
/474/9251/BqNL/index.cpp:62:32: error: must #includebefore using typeid
? ? if(typeid(*obj)==typeid(Bus))
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
/474/9251/BqNL/index.cpp:68:16: error: must #includebefore using typeid
? ? if(typeid(*obj) == typeid(Tank))
? ? ? ? ? ? ? ?^
/474/9251/BqNL/index.cpp:68:35: error: must #includebefore using typeid
? ? if(typeid(*obj) == typeid(Tank))
2018-04-18
頭文件的類容有所不同吧,VS可能自帶了對(duì)typeid的定義
2016-01-26
要加上
#include<typeinfo>