Mercurial > projects > ldc
annotate test/interface6.d @ 119:79c9ac745fbc trunk
[svn r123] Fixed some typeinfo module name mismatches.
Fixed D-style varargs returning through pointer.
Fixed converting nested function to delegate.
Added std.string and std.format to Phobos.
author | lindquist |
---|---|
date | Mon, 26 Nov 2007 06:45:13 +0100 |
parents | 5880c12dba83 |
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 } |