On Tue, 11 Oct 2011 12:40:29 -0400, Andrej Mitrovic <[email protected]> wrote:

Nope. Private ctors have to be called from within the same module,
whether implicit or not:

test.d:
class Foo
{
    private this() { }  // Error: constructor main.Bar.this no match
for implicit super() call in constructor
}

import test;
class Bar : Foo
{
    this() { }
}

void main()
{
    auto bar = new Bar();
}

Hm... that makes sense.

You can try mucking around with roll-your-own construction. That is, ignore the constructor and use a mixture of public final initialize functions + protected virtual initialize functions.

It might just be something that you have to accept is not definable by the base class :(

C++ requires construction of base classes before the main body of a derived constructor is called. And that has its own problems too...

-Steve

Reply via email to