Hi
I have the following snippet to illustrate my problem/question:
class X
{
import std.stdio: write, File, stdout;
private File* f = &stdout;
void p(string s) const
{
f.write(s);
}
}
class Y
{
private string s = "Y";
override string toString() const
{
return s;
}
}
void main()
{
auto x = new X;
auto y = new Y;
import std.conv: to;
x.p(to!string(y));
}
Why is this thing not compiling ?
Or, in other words, how is is possible to log something to a file
from a const member function ?
Thanks in advance