Mercurial > projects > ldc
annotate tests/mini/interface6.d @ 1453:f35a9a77d256
More tweaks.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Mon, 01 Jun 2009 18:58:21 +0100 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
114 | 1 module interface6; |
2 | |
133
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
114
diff
changeset
|
3 extern(C) int printf(char*,...); |
44a95ac7368a
[svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents:
114
diff
changeset
|
4 |
114 | 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 } |