Mercurial > projects > ldc
comparison tests/mini/j.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 | tangotests/j.d@44a95ac7368a |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module j; | |
2 | |
3 interface Inter1 | |
4 { | |
5 int func1(); | |
6 } | |
7 | |
8 interface Inter2 | |
9 { | |
10 int func2(); | |
11 } | |
12 | |
13 class C12 : Inter1, Inter2 | |
14 { | |
15 int func1() | |
16 { | |
17 return 1; | |
18 } | |
19 int func2() | |
20 { | |
21 return 2; | |
22 } | |
23 } | |
24 | |
25 void func(Object c) | |
26 { | |
27 auto i1 = cast(Inter1)c; | |
28 assert(i1.func1() == 1); | |
29 auto i2 = cast(Inter2)c; | |
30 assert(i2.func2() == 2); | |
31 auto j1 = cast(Inter1)i2; | |
32 assert(j1.func1() == 1); | |
33 auto j2 = cast(Inter2)i1; | |
34 assert(j2.func2() == 2); | |
35 } | |
36 | |
37 void main() | |
38 { | |
39 scope c = new C12; | |
40 func(c); | |
41 printf("OK\n"); | |
42 } | |
43 | |
44 extern(C) int printf(char*,...); |