Interface reference
Kirk McDonald
kirklin.mcdonald at gmail.com
Fri Jul 4 17:26:23 PDT 2008
Michael Koehmstedt wrote:
> I just read this in the book "Learn to Tango with D", page 73:
>
> "It is not possible to instantiate interfaces, but you can have references to class instances through the type of an interface that the class implements."
>
> Could anyone give an example of what this means?
>
>
>
interface I {
void foo();
}
class C : I {
override void foo() {}
}
void main() {
I i = new C; // reference to class instance of interface type
i.foo();
}
--
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org
More information about the Digitalmars-d
mailing list