On Thursday, 24 September 2015 at 11:26:12 UTC, Marc Schütz wrote:
On Thursday, 24 September 2015 at 01:01:09 UTC, Nicholas Wilson
wrote:
On Wednesday, 23 September 2015 at 21:25:15 UTC, tcak wrote:
On Wednesday, 23 September 2015 at 21:14:17 UTC, Adam D.
Ruppe wrote:
[...]
Is there any way to prevent this behaviour?
Quickly checked whether Java acts in the same way. Answer is
yes.
You might be able to swap out the vtbl entry for a stub call
it and trick the compiler and swap it back, but...
Urgh...
If you can modify the base class, and you really need it, you
can check the dynamic type:
class Base {
this() {
if(!cast(Base) this) return;
// do the initialization
}
}
doesn't upcasting always work? iirc only down casting can return
null.