Mercurial > projects > ldc
comparison tests/mini/interface4.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/interface4.d@44a95ac7368a |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module interface4; | |
2 | |
3 extern(C) int printf(char*,...); | |
4 | |
5 interface I | |
6 { | |
7 void func(); | |
8 } | |
9 | |
10 interface I2 | |
11 { | |
12 void func(); | |
13 } | |
14 | |
15 class C : I,I2 | |
16 { | |
17 int i = 42; | |
18 override void func() | |
19 { | |
20 printf("hello %d\n", i); | |
21 i++; | |
22 } | |
23 } | |
24 | |
25 void main() | |
26 { | |
27 scope c = new C; | |
28 c.func(); | |
29 I i = c; | |
30 i.func(); | |
31 I2 i2 = c; | |
32 i2.func(); | |
33 printf("final %d\n", c.i); | |
34 assert(c.i == 45); | |
35 } |