comparison test/interface3.d @ 113:27b9f749d9fe trunk

[svn r117] Initial working implementation of interfaces. Groundwork for all the different types of class/interface casts laid out.
author lindquist
date Sat, 24 Nov 2007 06:33:00 +0100
parents
children 44a95ac7368a
comparison
equal deleted inserted replaced
112:368547b1cbe6 113:27b9f749d9fe
1 module interface3;
2
3 interface I
4 {
5 void func();
6 }
7
8 class C : I
9 {
10 int i = 42;
11 override void func()
12 {
13 printf("hello %d\n", i);
14 i++;
15 }
16 }
17
18 void main()
19 {
20 scope c = new C;
21 {c.func();}
22 {
23 I i = c;
24 {i.func();}
25 }
26 {printf("final %d\n", c.i);}
27 {assert(c.i == 44);}
28 }