Mercurial > projects > ldc
comparison tests/mini/interface6.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/interface6.d@44a95ac7368a |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module interface6; | |
2 | |
3 extern(C) int printf(char*,...); | |
4 | |
5 interface I | |
6 { | |
7 void Ifunc(); | |
8 } | |
9 | |
10 interface J | |
11 { | |
12 void Jfunc(); | |
13 } | |
14 | |
15 class C : I,J | |
16 { | |
17 int i; | |
18 int j; | |
19 void Ifunc() | |
20 { | |
21 i++; | |
22 } | |
23 void Jfunc() | |
24 { | |
25 j++; | |
26 } | |
27 } | |
28 | |
29 void main() | |
30 { | |
31 C c = new C; | |
32 c.Ifunc(); | |
33 c.Jfunc(); | |
34 I i = c; | |
35 i.Ifunc(); | |
36 J j = c; | |
37 j.Jfunc(); | |
38 C c2 = cast(C)i; | |
39 c2.Ifunc(); | |
40 c2.Jfunc(); | |
41 C c3 = cast(C)j; | |
42 c3.Ifunc(); | |
43 c3.Jfunc(); | |
44 assert(c.i == 4); | |
45 assert(c.j == 4); | |
46 } |