推 light0617:謝謝 不過我真不知道問題出在哪@@ bottom.next=null 11/02 00:36
→ light0617:我後來發現應該是沒問題 11/02 00:37
推 light0617:未處理的例外狀況 System.NullReferenceException:並未 11/02 00:52
→ light0617:將物件參考設定為物件的 11/02 00:53
→ light0617:這段話的意思 11/02 00:53
在C#裡,只要你是用class定義的東西,一定都要建立實體才能用
譬如說:
class box {
public box() {}
public char num;
public box next;
}
某個函式:
{
box b = new box();
b.num = 'a';
}
而不能: (你的程式問題就在這裡)
{
box b = null;
b.num = 'a'; // 執行到這裡,一定會出現 System.NullReferenceException
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.127.184.214
推 light0617:感恩!!! 我終於懂了 11/02 01:20