D rawkz! -- custom writefln formats
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Jan 17 11:20:49 PST 2013
On 1/16/13, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> I'm guessing that most D users don't realize extent of the flexibility
> of std.format
There's a problem:
module test;
import std.stdio;
class C1 { }
class C2 : C1
{
void toString(scope void delegate(const(char)[]) put)
{
put("Subclass");
}
}
void main()
{
C1 c = new C2();
writeln(c); // writes 'test.C2'
}
I think this might be a problem of having the Object root class
implement toString.
More information about the Digitalmars-d
mailing list