Mercurial > projects > dstress
changeset 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 | 6a663dfca2a5 |
children | db4b6169a99d |
files | run/auto_07.d run/auto_08.d |
diffstat | 2 files changed, 76 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/auto_07.d Fri Apr 15 01:59:35 2005 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Sean Kelly <sean@f4.ca> +// @date@ 2005-04-14 +// @uri@ news:d3kvo3$3uf$1@digitaldaemon.com + +module dstress.run.auto_07; + +int status; + +auto class Parent{ +} + +auto class Child : Parent{ + this(){ + assert(status==0); + status=1; + } + + ~this(){ + assert(status==1); + status=2; + } +} + +void test(){ + auto Parent o = new Child(); + assert(status==1); +} + +int main(){ + test(); + assert(status==2); + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/auto_08.d Fri Apr 15 01:59:35 2005 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Sean Kelly <sean@f4.ca> +// @date@ 2005-04-14 +// @uri@ news:d3kvo3$3uf$1@digitaldaemon.com + +module dstress.run.auto_08; + +int status; + +auto class Parent{ +} + +auto class Child : Parent{ + this(){ + assert(status==0); + status=1; + } + + ~this(){ + assert(status==1); + status=2; + } +} + +void test(){ + auto Child o = new Child(); + assert(status==1); +} + +int main(){ + test(); + assert(status==2); + return 0; +} +