class C { private int i; int method() { return i; } } class D { private int delegate(void) _deleg; this(int delegate(void) d) { _deleg = d; } void write() { if(_deleg !is null) } writef(_deleg()); } } } C c = null; D d = new d; d.function(c.method()); //This fails, as method is not availible for null. d.function({return c.method();}); //This works but now I can't check whether c is null or not. d.write(); //will fail.
Any suggestions?