第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

C++多態(tài)篇課上的一個(gè)例子運(yùn)行出錯(cuò),關(guān)于抽象類的

C++多態(tài)篇課上的一個(gè)例子運(yùn)行出錯(cuò),關(guān)于抽象類的

C++
BlueCitizen 2015-12-06 12:13:56
//Person類的定義 #ifndef?PERSON_H_ #define?PERSON_H_ using?namespace?std; #include?<string> class?Person{ public: ????Person(string?name); ????virtual?~Person(); ????virtual?void?work()?=?0; protected: ????string?m_strName; }; #endif//Person類的實(shí)現(xiàn) #include?"Person.h" #include?<iostream> Person::Person(string?name) { ????m_strName?=?name; ????cout?<<?"Person()"?<<?endl; } Person::~Person() { ????cout?<<?"~Person"?<<?endl; }//Worker類的定義 #ifndef?WORKER_H_ #define?WORKER_H_ #include?"Person.h" class?Worker?:public?Person { public: ????Worker(string?name,int?age); ????virtual?~Worker(); ????//virtual?void?work(); protected: ????int?m_iAge; }; #endif//Worker類的實(shí)現(xiàn) #include"Worker.h" #include?<iostream> Worker::Worker(string?name,int?age)?:Person(name) { ????m_iAge?=?age; ????cout?<<?"Worker()"?<<?endl; } Worker::~Worker() { ????cout?<<?"~Worker"?<<?endl; }//Dustman類的定義 #ifndef?DUSTMAN_H_ #define?DUSTMAN_H_ #include?"Worker.h" class?Dustman?:public?Worker { public: ????Dustman(string?name,int?age); ????~Dustman(); ????virtual?void?work(); }; #endif//Dustman類的實(shí)現(xiàn) #include?"Dustman.h" #include?<iostream> Dustman::Dustman(string?name,?int?age)?:Worker(name,age) { ????cout?<<?"Dustman()"?<<?endl; } Dustman::~Dustman() { ????cout?<<?"~Dustman"?<<?endl; } void?Dustman::work() { ????cout?<<?"work()"?<<?endl; }//main函數(shù) #include?<iostream> #include?"Dustman.h" #include?<stdlib.h> using?namespace?std; int?main(void){ ????Dustman?persn("jin",20); ????system("pause"); ????return?0; }編譯可以通過(guò),但運(yùn)行就會(huì)報(bào)錯(cuò),下面是所有的錯(cuò)誤提示,點(diǎn)擊錯(cuò)誤提示不能提示是哪一行出錯(cuò)了,所以搞不明白哪兒錯(cuò)了警告?? ?1?? ?warning LNK4042: 對(duì)象被多次指定;已忽略多余的指定?? ?E:\visual studio 2013\Projects\test\test\Debug\Dustman.obj?? ?1?? ?1?? ?test警告?? ?2?? ?warning LNK4042: 對(duì)象被多次指定;已忽略多余的指定?? ?E:\visual studio 2013\Projects\test\test\Debug\Person.obj?? ?1?? ?1?? ?test錯(cuò)誤?? ?3?? ?error LNK2019: 無(wú)法解析的外部符號(hào) "public: __thiscall Dustman::Dustman(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (??0Dustman@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),該符號(hào)在函數(shù) _main 中被引用?? ?E:\visual studio 2013\Projects\test\test\demo.obj?? ?test錯(cuò)誤?? ?4?? ?error LNK2019: 無(wú)法解析的外部符號(hào) "public: virtual __thiscall Dustman::~Dustman(void)" (??1Dustman@@UAE@XZ),該符號(hào)在函數(shù) _main 中被引用?? ?E:\visual studio 2013\Projects\test\test\demo.obj?? ?test錯(cuò)誤?? ?5?? ?error LNK1120: 2 個(gè)無(wú)法解析的外部命令?? ?E:\visual studio 2013\Projects\test\Debug\test.exe?? ?test
查看完整描述

1 回答

  • 1 回答
  • 1 關(guān)注
  • 1512 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)