On Fri, 07 Oct 2011 23:02:33 +0100, Andrej Mitrovic
<andrej.mitrov...@gmail.com> wrote:
So I'm looking for some techniques or tricks (or, dare I say, design
patterns :x) you guys might have if you've ever ran into this kind of
problem.
The best I can come up with is a runtime solution:
import std.stdio;
class Base {
private bool _init = false;
this(int x) { _init = true; }
void foo()
{
if (_init) writefln("ok");
else writefln("not initialised");
}
}
class DerivedWell : Base {
this(int x) {
super(x);
foo();
}
}
class DerivedBadly : Base {
this(int x) {
foo();
super(x);
}
}
void main()
{
auto d1 = new DerivedWell(1);
auto d2 = new DerivedBadly(1);
}
--
Using Opera's revolutionary email client: http://www.opera.com/mail/