mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-30 03:23:19 +01:00
[svn r117] Initial working implementation of interfaces.
Groundwork for all the different types of class/interface casts laid out.
This commit is contained in:
35
test/interface2.d
Normal file
35
test/interface2.d
Normal file
@@ -0,0 +1,35 @@
|
||||
module interface2;
|
||||
|
||||
interface A
|
||||
{
|
||||
void a();
|
||||
}
|
||||
|
||||
interface B
|
||||
{
|
||||
void b();
|
||||
}
|
||||
|
||||
class C : A,B
|
||||
{
|
||||
int i = 0;
|
||||
override void a()
|
||||
{
|
||||
printf("hello from C.a\n");
|
||||
}
|
||||
override void b()
|
||||
{
|
||||
printf("hello from C.b\n");
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
scope c = new C;
|
||||
{c.a();
|
||||
c.b();}
|
||||
{A a = c;
|
||||
a.a();}
|
||||
{B b = c;
|
||||
b.b();}
|
||||
}
|
||||
Reference in New Issue
Block a user