Mercurial > projects > dstress
changeset 173:6c00d3fd09ec
class_initialization
k2 <k2_member@pathlink.com>
2004-11-30
news:cohgrc$n3v$1@digitaldaemon.com
nntp://news.digitalmars.com/digitalmars.D.bugs/2379
author | thomask |
---|---|
date | Wed, 01 Dec 2004 14:44:06 +0000 |
parents | e5bbb877feb9 |
children | b824116874df |
files | run/class_initialization_01.d run/class_initialization_02.d |
diffstat | 2 files changed, 74 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/class_initialization_01.d Wed Dec 01 14:44:06 2004 +0000 @@ -0,0 +1,36 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ k2 <k2_member@pathlink.com> +// @date@ 2004-11-30 +// @uri@ news:cohgrc$n3v$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2379 + +module dstress.run.class_initialization_01; + +class Parent{ + int s; + this(){ + } +} + + +class Child : Parent { + int a; + int b; + int c; + int d; +} + +int main(){ + Child a = new Child(); + + assert(a.s == 0); + assert(a.a == 0); + assert(a.b == 0); + assert(a.c == 0); + assert(a.d == 0); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/class_initialization_02.d Wed Dec 01 14:44:06 2004 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ k2 <k2_member@pathlink.com> +// @date@ 2004-11-30 +// @uri@ news:cohgrc$n3v$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2379 + +module dstress.run.class_initialization_02; + +class Parent{ + int s; + this(){ + } +} + + +class Child : Parent { + this(){ + } + int a; + int b; + int c; + int d; +} + +int main(){ + Child a = new Child(); + + assert(a.s == 0); + assert(a.a == 0); + assert(a.b == 0); + assert(a.c == 0); + assert(a.d == 0); + + return 0; +}