changeset 208:278884e3a78d

botched constructor Ilya Zaitseff <sark7@mail333.com> 2004-12-21 news:opsja8b9ddaaezs2@robingood nntp://digitalmars.com/digitalmars.D.bugs/2584
author thomask
date Thu, 23 Dec 2004 20:52:20 +0000
parents d59b1bc64d25
children e636fe6f12d6
files run/constructor_07.d run/constructor_08.d
diffstat 2 files changed, 81 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/constructor_07.d	Thu Dec 23 20:52:20 2004 +0000
@@ -0,0 +1,40 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Ilya Zaitseff <sark7@mail333.com>
+// @date@	2004-12-21
+// @uri@	news:opsja8b9ddaaezs2@robingood
+// @url@	nntp://digitalmars.com/digitalmars.D.bugs/2584
+
+module dstress.run.constructor_07;
+
+class A{
+	this() {}
+}
+
+class B : A {
+	int foo;
+}
+
+class C : B {
+	int bar;
+
+	this(){
+		foo = 0;
+		bar = 1;
+	}
+}
+
+int main(){
+	C c = new C();
+	assert(c.foo==0);
+	assert(c.bar==1);
+	c.foo=2;
+	assert(c.foo==2);
+	assert(c.bar==1);
+	c.bar=-1;
+	assert(c.foo==2);
+	assert(c.bar==-1);
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/constructor_08.d	Thu Dec 23 20:52:20 2004 +0000
@@ -0,0 +1,41 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Ilya Zaitseff <sark7@mail333.com>
+// @date@	2004-12-21
+// @uri@	news:opsja8b9ddaaezs2@robingood
+// @url@	nntp://digitalmars.com/digitalmars.D.bugs/2584
+
+module dstress.run.constructor_08;
+
+class A{
+	this() {}
+}
+
+class B : A {
+	int foo;
+	this {}
+}
+
+class C : B {
+	int bar;
+
+	this(){
+		foo = 0;
+		bar = 1;
+	}
+}
+
+int main(){
+	C c = new C();
+	assert(c.foo==0);
+	assert(c.bar==1);
+	c.foo=2;
+	assert(c.foo==2);
+	assert(c.bar==1);
+	c.bar=-1;
+	assert(c.foo==2);
+	assert(c.bar==-1);
+	return 0;
+}