作者walm20 (我要买车啦)
看板java
标题Re: [问题] interface里的attribute const?
时间Fri Apr 13 00:07:50 2007
※ 引述《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