看板 java 關於我們 聯絡資訊
倒不如改成這樣來體會 ==" ※ 引述《pzyc79 (I'm bored)》之銘言: : ===============Class Test:=============== : package a; : public class Test { : protected Test(){ : } public Test(String nothing) {} protected foo() {} : } : ===============Class Test2:============== : package b; : import a.Test; : public class Test2 extends Test{ Test() { super(); //OK } : void fun(){ : Test t = new Test(); //Test() is not visible Test t = new Test(""); //OK this.foo(); //OK : } : } : WHY? 宣告protected不是可以在子類別中看見嗎? 依照字面上解釋,只能說你的疑惑我每天都有 [死] -- 錢鍾書: 說出來的話 http://www.psmonkey.org 比不上不說出來的話 Java 版 cookcomic 版 只影射著說不出來的話 and more...... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.43.104.99 ※ 文章網址: http://www.ptt.cc/bbs/java/M.1399741615.A.90E.html
pzyc79:只能說當protected寫在建構子上意思跟寫在成員上不一樣嗎 05/11 01:14
pzyc79:還有你加上去的程式錯了兩個地方 05/11 01:16
PsMonkey:意思有到就好 [喂喂] 然後其他大致同上一篇推文 05/11 01:20
singlovesong:其實版主真的蠻熱心的阿... 05/11 01:41
sbrhsieh:this.foo(); 改 t.foo(); 就不 OK,這就是.....人篸[誤] 05/11 02:52