Re: Why is the constructor of B called?

2015-09-24 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 24 September 2015 at 01:01:09 UTC, Nicholas Wilson wrote: On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote: On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: I wouldn't expect B's

Re: Why is the constructor of B called?

2015-09-24 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 24 September 2015 at 11:26:12 UTC, Marc Schütz wrote: On Thursday, 24 September 2015 at 01:01:09 UTC, Nicholas Wilson wrote: On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote: On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: [...] Is there any way

Re: Why is the constructor of B called?

2015-09-24 Thread Artur Skawina via Digitalmars-d-learn
On 09/24/15 13:26, Marc Schütz via Digitalmars-d-learn wrote: > On Thursday, 24 September 2015 at 01:01:09 UTC, Nicholas Wilson wrote: >> On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote: >>> On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: On Wednesday, 23

Re: Why is the constructor of B called?

2015-09-23 Thread tcak via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: I wouldn't expect B's constructor to be called at all unless "super" is used there. "If no call to constructors via this or super appear in a constructor, and

Re: Why is the constructor of B called?

2015-09-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: I wouldn't expect B's constructor to be called at all unless "super" is used there. "If no call to constructors via this or super appear in a constructor, and the base class has a constructor, a call to super() is inserted at the

Re: Why is the constructor of B called?

2015-09-23 Thread Ali Çehreli via Digitalmars-d-learn
On 09/23/2015 02:25 PM, tcak wrote: On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: I wouldn't expect B's constructor to be called at all unless "super" is used there. "If no call to constructors via this or

Why is the constructor of B called?

2015-09-23 Thread tcak via Digitalmars-d-learn
[code] import std.stdio; class B { this() { writeln("B.constructor"); foo(); } void foo() { writeln("B.foo"); } } class D : B { this() { writeln("D.constructor"); } override

Re: Why is the constructor of B called?

2015-09-23 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Sep 23, 2015 at 03:25:04PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 09/23/2015 02:25 PM, tcak wrote: > >On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: > >>On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: > >>>I wouldn't expect B's

Re: Why is the constructor of B called?

2015-09-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote: On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D. Ruppe wrote: On Wednesday, 23 September 2015 at 21:08:37 UTC, tcak wrote: I wouldn't expect B's constructor to be called at all unless "super" is used there. "If no call to