On 2014-06-15 11:40, Dmitry Olshansky wrote:

No, normal exceptions print just fine. e.g.
writeln(new Exception("abc"));
I'm wondering what's wrong the one I defined, the error message seems to
indicate that it doesn't have toString. It's wrong as there is one
derived from Exception.

Workaround was to use
alias toString = Base.toString;

Is this because "writeln" tries to use the one without parameters? If you override one method, which as overloads, you need to override all overloads or bring them into the same overload set with an alias, as you've done above.

A base class and subclass have different overload sets [1].

[1] http://dlang.org/hijack.html search for "Derived Class Member Function Hijacking".

--
/Jacob Carlborg

Reply via email to