Mercurial > projects > ldc
annotate test/interface5.d @ 271:1e6e2b5d5bfe trunk
[svn r292] Fixed: string switch was broken in several ways.
Fixed: TypeInfo_Typedef.next was incorrect (return base of base instead of just base).
Fixed: ClassInfo offset type info (offTi) had invalid offsets.
author | lindquist |
---|---|
date | Wed, 18 Jun 2008 21:31:05 +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 } |