Mercurial > projects > ldc
annotate test/interface5.d @ 281:f5f97ca47b33 trunk
[svn r302] Make HaltExps and assert(0) generate an assert message again instead of using llvm's trap intrinsic.
author | ChristianK |
---|---|
date | Fri, 20 Jun 2008 23:38:51 +0200 |
parents | 44a95ac7368a |
children |
rev | line source |
---|---|
114 | 1 module interface5; |
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 func(); | |
8 } | |
9 | |
10 class C : I | |
11 { | |
12 int i; | |
13 void func() | |
14 { | |
15 printf("C\n"); | |
16 i++; | |
17 } | |
18 } | |
19 | |
20 void main() | |
21 { | |
22 C c = new C; | |
23 c.func(); | |
24 { | |
25 I i = c; | |
26 c.func(); | |
27 | |
28 C c2 = cast(C)i; | |
29 c2.func(); | |
30 | |
31 c.func(); | |
32 assert(c.i == 4); | |
33 } | |
34 } |