看板 C_Sharp 關於我們 聯絡資訊
我寫了一個簡單的constructor如下 class Human { public Human(string scolor, string sex){.....} public Human(int age, int hight){.....} } 我的destructor是否只要寫成 ~Human() 就可以把我上面二個constructor所佔用的資源都放掉?? 我有試過把destructor加入一樣的參數,但是我的compile不會過.... 所以我猜應該是跟我想的一樣,但還是想要上來求證一下 謝謝前輩辛苦的回答新手的小問題 十分的謝謝大大的回答唷^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.131.122.27
AuronC:解構子應該只有一個...釋放不要用的資源 02/13 20:56
horngsh:記得沒錯的話, destructor不能函式複載 02/15 14:36