Mercurial > projects > dstress
comparison run/mini/t.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1627:e1b954780837 | 1628:c6ef09dfba4d |
---|---|
1 interface MyInterface | |
2 { | |
3 int func(); | |
4 } | |
5 | |
6 class MyClass : MyInterface | |
7 { | |
8 int var; | |
9 int func() | |
10 { | |
11 return var; | |
12 } | |
13 } | |
14 | |
15 void func1(MyInterface i) | |
16 { | |
17 int delegate() dg = &i.func; | |
18 func2(dg); | |
19 } | |
20 | |
21 extern(C) int printf(char*, ...); | |
22 | |
23 void func2(int delegate() dg) | |
24 { | |
25 int i = dg(); | |
26 printf("%d\n", i); | |
27 } | |
28 | |
29 void main() | |
30 { | |
31 auto c = new MyClass; | |
32 c.var = 42; | |
33 func1(c); | |
34 } |