Mercurial > projects > ldc
annotate tests/mini/interface5.d @ 786:45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 24 Nov 2008 20:02:59 +0100 |
parents | 1bb99290e03a |
children | dde9dbae052a |
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 } |