看板 java 關於我們 聯絡資訊
※ 引述《H45 (!H45)》之銘言: : ※ 引述《walm20 (我要買車啦)》之銘言: : : 在問一個問題 : : 課本寫說 : : interface and abstract class不行建立參考 : : 可是後面程式範例 : : 有建立interface參考到一個繼承這interface的物件(implement這interface的 class) : : 先謝謝大家摟 : 問題點在於,你了解什麼叫作「建立參考」嗎? : 是意指建立一個新的實體 istance : new Something(); : //where Something is not an interface nor an abstract class : 還是指某個 member field 的定義 : Otherthing otherthing; : //where Otherthing is an interface or an abstract class : 或者是指多型 Polymorphism : Otherthing otherthing = new Something(); : // where Something is a class that implements Otherthing, and : // Otherthing is an interface : 哪一道? 請問 class_type ref; 這個不是建立參考嗎? 還是宣告參考? 課本上(大概寫一下) Interface A { ... } class B implement A { ... } main裡面 B b=new B(); A a=b; // 這行的意思? 這樣不算建立interface的參考嗎? -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.169.119.35