Re: [問題] 在類別中生成一個自己的實例(static用 …

看板java作者 (godfat 真常)時間17年前 (2007/07/13 14:16), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/8 (看更多)
※ 引述《Ronamtis (Tis)》之銘言: : 感謝諸位大大的回答,我也看了良葛格筆記和蔡學鏞先生寫的解說: : http://www.oreilly.com.tw/column_sleepless.php?id=j021 : 觀念比較清楚了!不過在蔡學鏞的解說中提到 : 如果某 class 的 class method 或 instance method 欲使用到某 instance 的 : 某 instance method,就必須在前面冠上此 instance 名稱,例如:obj.classMethod() 不需要特別 forward 一份給我,基本上會回就是會看。 上面那句話其實有點問題,因為何謂 instance 名稱? Object a = new Object(); b = a; 這樣不就兩個名稱了?所以這說法覺得不太妥當。 : 所以 static 函式成員使用非 static 函式成員的話會發生錯誤,因為沒有 this 參考, : 但是可是自行加上物件名稱來使用非 static 的函式成員,例如 obj.instanceMethod() : 囉?(不知道自己有沒有在鑽牛角尖 :p) 大致上正確,除了「名稱」這個詞覺得不太妥當,應為 variable/reference/pointer or whatever related -- In Lisp, you don't just write your program down toward the language, you also build the language up toward your program. 《Programming Bottom-Up》- Paul Graham 1993 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.218.90.242
文章代碼(AID): #16bnYodg (java)
討論串 (同標題文章)
本文引述了以下文章的的內容:
以下文章回應了本文
完整討論串 (本文為第 4 之 8 篇):
文章代碼(AID): #16bnYodg (java)