Mercurial > projects > ldc
annotate test/interface6.d @ 114:5880c12dba83 trunk
[svn r118] Fixed dynamic casts.
Fixed a few interface bugs.
author | lindquist |
---|---|
date | Sun, 25 Nov 2007 00:19:13 +0100 |
parents | |
children | 44a95ac7368a |
rev | line source |
---|---|
114 | 1 module interface6; |
2 | |
3 interface I | |
4 { | |
5 void Ifunc(); | |
6 } | |
7 | |
8 interface J | |
9 { | |
10 void Jfunc(); | |
11 } | |
12 | |
13 class C : I,J | |
14 { | |
15 int i; | |
16 int j; | |
17 void Ifunc() | |
18 { | |
19 i++; | |
20 } | |
21 void Jfunc() | |
22 { | |
23 j++; | |
24 } | |
25 } | |
26 | |
27 void main() | |
28 { | |
29 C c = new C; | |
30 c.Ifunc(); | |
31 c.Jfunc(); | |
32 I i = c; | |
33 i.Ifunc(); | |
34 J j = c; | |
35 j.Jfunc(); | |
36 C c2 = cast(C)i; | |
37 c2.Ifunc(); | |
38 c2.Jfunc(); | |
39 C c3 = cast(C)j; | |
40 c3.Ifunc(); | |
41 c3.Jfunc(); | |
42 assert(c.i == 4); | |
43 assert(c.j == 4); | |
44 } |