annotate run/auto_08.d @ 431:61ec77e09b1e

auto dtor / inheritance Sean Kelly <sean@f4.ca> 2005-04-14 news:d3kvo3$3uf$1@digitaldaemon.com
author thomask
date Fri, 15 Apr 2005 01:59:35 +0000
parents
children c67acdbaf88e
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_08;
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 Child 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();
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
35 assert(status==2);
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
36 return 0;
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
37 }
61ec77e09b1e auto dtor / inheritance
thomask
parents:
diff changeset
38