Thread overview | ||||||
---|---|---|---|---|---|---|
|
November 30, 2004 [dmd v0.107 win32] Class member initialize | ||||
---|---|---|---|---|
| ||||
class S { int s; this() { } } class A : S { int a; int b; int c; int d; } void main() { A a = new A; printf("%d\n", a.s); printf("%d\n", a.a); printf("%d\n", a.b); printf("%d\n", a.c); printf("%d\n", a.d); } -- outputs 0 0 4264420 8850976 0 |
November 30, 2004 Re: [dmd v0.107 win32] Class member initialize | ||||
---|---|---|---|---|
| ||||
Posted in reply to k2 | On Tue, 30 Nov 2004 10:08:44 +0000 (UTC), k2 <k2_member@pathlink.com> wrote: > class S { > int s; > this() > { > } > } > > > class A : S { > int a; > int b; > int c; > int d; > } > > void main() > { > A a = new A; > > printf("%d\n", a.s); > printf("%d\n", a.a); > printf("%d\n", a.b); > printf("%d\n", a.c); > printf("%d\n", a.d); > } > > -- outputs > 0 > 0 > 4264420 > 8850976 > 0 > > I get > "main.exe" 0 0 0 0 0 > Terminated with exit code 2. -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" "Clearly, if I were one of that Predator hunting team, I would file a complaint with my local member asking why such an unsafe environment should be allowed to continue, tradition or not." - http://www.sydneyanglicans.net/culture/watching/alien_vs_predator/ |
December 01, 2004 Re: [dmd v0.107 win32] Class member initialize | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simon Buchan | I'm using Windows 2000. If add constructor to class A, I get right result. In article <opsh9zh6l7jccy7t@simon.homenet>, Simon Buchan says... > >On Tue, 30 Nov 2004 10:08:44 +0000 (UTC), k2 <k2_member@pathlink.com> wrote: > >> class S { >> int s; >> this() >> { >> } >> } >> >> >> class A : S { >> int a; >> int b; >> int c; >> int d; >> } >> >> void main() >> { >> A a = new A; >> >> printf("%d\n", a.s); >> printf("%d\n", a.a); >> printf("%d\n", a.b); >> printf("%d\n", a.c); >> printf("%d\n", a.d); >> } >> >> -- outputs >> 0 >> 0 >> 4264420 >> 8850976 >> 0 >> >> > >I get >> "main.exe" >0 >0 >0 >0 >0 > >> Terminated with exit code 2. |
December 01, 2004 Re: [dmd v0.107 win32] Class member initialize | ||||
---|---|---|---|---|
| ||||
Posted in reply to k2 | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Added to DStress as http://svn.kuehne.cn/dstress/run/class_initialization_01.d http://svn.kuehne.cn/dstress/run/class_initialization_02.d Thomas k2 schrieb am Tue, 30 Nov 2004 10:08:44 +0000 (UTC): > class S { > int s; > this() > { > } > } > > > class A : S { > int a; > int b; > int c; > int d; > } > > void main() > { > A a = new A; > > printf("%d\n", a.s); > printf("%d\n", a.a); > printf("%d\n", a.b); > printf("%d\n", a.c); > printf("%d\n", a.d); > } > > -- outputs > 0 > 0 > 4264420 > 8850976 > 0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.12 (GNU/Linux) iD8DBQFBrdCa3w+/yD4P9tIRAtDlAJ9Fg2MXp6QTmHS0crDIC+6OuWeF2wCePJFP 7T5bg0fvCcyJ92kdWD+o1DQ= =Y4Wk -----END PGP SIGNATURE----- |
Copyright © 1999-2021 by the D Language Foundation