精華區beta ck54th329 關於我們 聯絡資訊
在class裡頭 compiler不淮我宣告陣列 要怎麼處理? -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 210.85.118.7 > -------------------------------------------------------------------------- < 作者: Upsha (Marin hardtail好棒) 看板: ck54th329 標題: Re: upsha 時間: Fri Dec 6 23:44:34 2002 ※ 引述《ugoc (傷兵)》之銘言: : 在class裡頭 : compiler不淮我宣告陣列 : 要怎麼處理? 不確定我是否了你的問題 post個code吧...@@ -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 218.160.2.70 > -------------------------------------------------------------------------- < 作者: ugoc (傷兵) 看板: ck54th329 標題: Re: upsha 時間: Fri Dec 6 23:50:56 2002 ※ 引述《Upsha (Marin hardtail好棒)》之銘言: : ※ 引述《ugoc (傷兵)》之銘言: : : 在class裡頭 : : compiler不淮我宣告陣列 : : 要怎麼處理? : 不確定我是否了你的問題 post個code吧...@@ 舉例 class ALotOfArray{ int array[10]={0}; } 這個就不行啦 -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 210.85.118.7 > -------------------------------------------------------------------------- < 作者: Upsha (Marin hardtail好棒) 看板: ck54th329 標題: Re: upsha 時間: Fri Dec 6 23:54:15 2002 ※ 引述《ugoc (傷兵)》之銘言: : ※ 引述《Upsha (Marin hardtail好棒)》之銘言: : : 不確定我是否了你的問題 post個code吧...@@ : 舉例 : class ALotOfArray{ : int array[10]={0}; ^^^^you cant do this in declare do it in your ctor : } : 這個就不行啦 -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 218.160.2.70
ugoc:寫得太簡了我看不懂… 推 210.85.118.7 12/06
> -------------------------------------------------------------------------- < 作者: Upsha (Marin hardtail好棒) 看板: ck54th329 標題: Re: upsha 時間: Sat Dec 7 00:00:15 2002 ※ 引述《Upsha (Marin hardtail好棒)》之銘言: ※ 引述《ugoc (傷兵)》之銘言: : ※ 引述《Upsha (Marin hardtail好棒)》之銘言: : : 不確定我是否了你的問題 post個code吧...@@ : 舉例 : class ALotOfArray{ : int array[10]={0}; ^^^^you cant do this in declare do it in your ctor : } : 這個就不行啦 -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 218.160.2.70
ugoc:寫得太簡了我看不懂… 推 210.85.118.7 12/06
抱歉了...@@ 要注意 declare只能處理靜態的東西 也就是 告訴compiler你需要什麼東西 也就是 func prototype & data member = 是個賦值的動作 是需要『程式動作』的 所以對data member的initial動作 就放在constructor(簡稱ctor) 這樣了嗎? -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 218.160.2.70 ※ 編輯: Upsha 來自: 218.160.2.70 (12/07 00:07)
ugoc:了解了^^謝謝 推 210.85.118.7 12/07