Mercurial > projects > dstress
annotate run/i/interface_23_C.d @ 1319:81222734adf3
sed'ed replacement of new:...http.d.puremagic.co... with http://d.puremagic.com/issues/show_bug.cgi?...
author | thomask |
---|---|
date | Sun, 31 Dec 2006 19:58:06 +0000 |
parents | 47ef91337f5f |
children |
rev | line source |
---|---|
931 | 1 // $HeadURL$ |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 // @author@ <smjg@iname.com> | |
6 // @date@ 2006-03-22 | |
1319
81222734adf3
sed'ed replacement of new:...http.d.puremagic.co... with http://d.puremagic.com/issues/show_bug.cgi?...
thomask
parents:
931
diff
changeset
|
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=65 |
931 | 8 |
9 module dstress.run.i.interface_23_C; | |
10 | |
11 int status; | |
12 | |
13 interface I { | |
14 int showData(); | |
15 } | |
16 | |
17 class Parent { | |
18 I test() { | |
19 status += 7; | |
20 return new Child(42); | |
21 } | |
22 } | |
23 | |
24 class Child : Parent, I { | |
25 int data; | |
26 | |
27 this(int d) { | |
28 data = d; | |
29 } | |
30 | |
31 Child test() { | |
32 status += 1; | |
33 return new Child(69); | |
34 } | |
35 | |
36 int showData(){ | |
37 return data; | |
38 } | |
39 } | |
40 | |
41 int main() { | |
42 Child a = new Child(105); | |
43 assert(a); | |
44 assert(status == 0); | |
45 assert(a.data == 105); | |
46 | |
47 Parent p = a; | |
48 assert(a); | |
49 assert(status == 0); | |
50 | |
51 a.test(); | |
52 assert(status == 1); | |
53 | |
54 I i = p.test(); | |
55 assert(i); | |
56 assert(status == 2); | |
57 | |
58 assert(a.data == 105); | |
59 assert(a.showData() == 105); | |
60 assert(i.showData() == 69); | |
61 | |
62 return 0; | |
63 } | |
64 |