annotate run/auto_07.d @ 799:c67acdbaf88e

Sean Kelly <sean@f4.ca> 2006-01-24 news:dr5uqg$2hn7$1@digitaldaemon.com
author thomask
date Wed, 25 Jan 2006 08:03:40 +0000
parents 61ec77e09b1e
children b8c0195059d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
431
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
1 // $HeadURL$
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
2 // $Date$
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
3 // $Author$
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
4
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
5 // @author@ Sean Kelly <sean@f4.ca>
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
6 // @date@ 2005-04-14
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
7 // @uri@ news:d3kvo3$3uf$1@digitaldaemon.com
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
8
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
9 module dstress.run.auto_07;
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
10
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
11 int status;
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
12
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
13 auto class Parent{
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
14 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
15
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
16 auto class Child : Parent{
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
17 this(){
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
18 assert(status==0);
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
19 status=1;
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
20 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
21
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
22 ~this(){
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
23 assert(status==1);
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
24 status=2;
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
25 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
26 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
27
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
28 void test(){
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
29 auto Parent o = new Child();
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
30 assert(status==1);
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
31 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
32
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
33 int main(){
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
34 test();
799
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
35
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
36 if(status==2){
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
37 return 0;
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
38 }
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
39
c67acdbaf88e Sean Kelly <sean@f4.ca>
thomask
parents: 431
diff changeset
40 assert(0);
431
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
41 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
42