toString multiple overrides

Ellery Newcomer ellery-newcomer at utulsa.edu
Fri Feb 10 20:41:20 PST 2012


dmd 2.057

Two mixin templates, each define toString, mix them in to your class and ..

Error: function test.X.T2!().toString multiple overrides of same function

So this behavior is new, but is it sensical?


Sample code:

mixin template T1(){
     string toString(){
     return "1";
     }
}
mixin template T2(){
     string toString(){
     return "2";
     }
}
class X{
  mixin T1!() a;
  mixin T2!() b;
}

void main(){
}


More information about the Digitalmars-d-learn mailing list