Hi,

Is it possible in D to achieve this effect:

class Super {
  typeof(this) doStuff() { ...; return this; }
}

class Sub : Super {
  //doStuff is NOT explicitly overridden here
}

Sub x = (new Sub()).doStuff();

The last line doesn't compile because doStuff() returns Super. Is there a way to make it return Sub without having to explicitly override the function?

Thanks in advance,

Ben :)

Reply via email to