defered new feature
downs
default_357-line at yahoo.de
Thu Oct 23 18:31:18 PDT 2008
BCS wrote:
> A number of times I have found my self wanting to have "new C(args)"
> return a class derived from C. I know this can be done with a static
> function or the like but syntactically, it's unappealing.
Amusing fact: you can assign to "this" in the constructor.
typedef bool Bogus;
const Bogus bogus = false;
class A { this() { this = new B; } this(Bogus) { } }
class B : A { this() { super(bogus); /* rest of constructor */ } }
More information about the Digitalmars-d
mailing list