为了账号安全,请及时绑定邮箱和手机立即绑定

和答案一样通过不了

/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))

正在回答

2 回答

头文件的类容有所不同吧,VS可能自带了对typeid的定义

0 回复 有任何疑惑可以回复我~

要加上

#include<typeinfo>

2 回复 有任何疑惑可以回复我~
#1

Foxyy

哥们,我想问问哈,我用VS编译的时候没有加#include<typeinfo>,怎么也通过了,如果不看你的回复我肯定还蒙在鼓里的
2016-06-07 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
C++远征之多态篇
  • 参与学习       66209    人
  • 解答问题       334    个

本教程将带领大家体会面向对象三大特性中的多态特性

进入课程

和答案一样通过不了

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号