Hi,
I'm new to D and played a bit with templates and delegates.
Now i discovered some behaviore that i don't understand.
Can somebody explain me why i get two different outputs?


import std.stdio;


interface A(T){
        bool GetBool();
        T getT();
}

class C:A!(double){
        override bool GetBool(){
                return false;
        }
        override double getT(){
                return 1;
        }
}

void mwriteln(T)( A!T delegate() dg){
        writeln(dg().getT());
}

void main()
{
        auto c = new C();
        writeln(c.getT());
        mwriteln!double({return new C();});
}

Reply via email to