[問題] 繼承&constructor
開發平台(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
01/13 23:28, 2F
→
01/13 23:29, , 3F
01/13 23:29, 3F
→
01/14 00:04, , 4F
01/14 00:04, 4F
→
01/14 00:06, , 5F
01/14 00:06, 5F
→
01/14 00:26, , 6F
01/14 00:26, 6F