Re: [語法] int sum(0)

看板C_and_CPP (C/C++)作者 (有趣生活)時間16年前 (2009/06/12 07:07), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/3 (看更多)
※ 引述《MoseHas (非主流摩斯) (′‧ω‧‵)》之銘言: : 比如constructor : class anything : { : public: : anything();//default : anything(int a,int b);//constructor : private: : int x; : int y; : } : int main() : { : anything something(10,20); : ... : } : 如果用 「 = 」 是沒辦法做initialization的 : 如有講錯的部分請強者補完,感謝~ 硬要用 = 來做初始化的話,可以用: anything something = anything(10,20); 在初始化時這樣做,不會造成多一次 copy constructor (temp object copying) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.126.1.195

06/12 14:29, , 1F
又多學到了 不過平常應該懶惰打這成這樣
06/12 14:29, 1F
文章代碼(AID): #1ACOuXqZ (C_and_CPP)
討論串 (同標題文章)
本文引述了以下文章的的內容:
2
4
完整討論串 (本文為第 3 之 3 篇):
2
4
6
13
文章代碼(AID): #1ACOuXqZ (C_and_CPP)