Mercurial > projects > dstress
annotate run/i/interface_23_A.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_A; | |
10 | |
11 int status; | |
12 | |
13 interface I { | |
14 } | |
15 | |
16 class Parent { | |
17 I test() { | |
18 status += 7; | |
19 return new Child(42); | |
20 } | |
21 } | |
22 | |
23 class Child : Parent, I { | |
24 int data; | |
25 | |
26 this(int d) { | |
27 data = d; | |
28 } | |
29 | |
30 override Child test() { | |
31 status += 1; | |
32 return new Child(69); | |
33 } | |
34 } | |
35 | |
36 int main() { | |
37 Child a = new Child(105); | |
38 assert(a); | |
39 assert(status == 0); | |
40 assert(a.data == 105); | |
41 | |
42 Parent p = a; | |
43 assert(p); | |
44 assert(status == 0); | |
45 | |
46 Child c = a.test(); | |
47 assert(c); | |
48 assert(status == 1); | |
49 assert(c.data == 69); | |
50 | |
51 I i = p.test(); | |
52 assert(i); | |
53 assert(status == 2); | |
54 | |
55 Child d = cast(Child) i; | |
56 assert(d); | |
57 assert(status == 2); | |
58 assert(d.data == 69); | |
59 | |
60 return 0; | |
61 } | |
62 |