[問題] 繼承&constructor

看板C_and_CPP作者 (猩猩)時間13年前 (2011/01/13 23:20), 編輯推噓0(006)
留言6則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) C++ class father( ){ public: father( ); const int a; }; class son( ):public father{ public: son( int A ); } 小弟想要用son的constructor來初始const int a 要怎麼寫啊? 嚐試過各種方法....一直有錯> < son::son( int A ):World_Map( A ),a( A_){....} 不知道 好混亂= = 感謝指點^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.155.167.222 ※ 編輯: vcshox 來自: 124.155.167.222 (01/13 23:20)

01/13 23:23, , 1F
你 : 之前就有問題了...
01/13 23:23, 1F

01/13 23:28, , 2F
0.0
01/13 23:28, 2F

01/13 23:29, , 3F
請大大指點Orz
01/13 23:29, 3F

01/14 00:04, , 4F
class father( ) { } 為什麼這個 father 會有括號...
01/14 00:04, 4F

01/14 00:06, , 5F
http://nopaste.csie.org/8611d 這是一種可能的寫法
01/14 00:06, 5F

01/14 00:26, , 6F
仔細看一下你的課本好嗎?
01/14 00:26, 6F
文章代碼(AID): #1DBnWr1P (C_and_CPP)