tcak via Digitalmars-d-learn
2014-10-14 20:58:18 UTC
I have written a struct and a mixin template, and that mixin
template is mixed into that struct as follows.
private mixin template TestCommonMethods(){
public bool apply( int d, int e ){
return false;
}
}
public struct Test{
public mixin TestCommonMethods;
public bool apply( char c ){
return true;
}
}
void main(){
Test t;
t.apply( 5, 3 );
}
---
For the line "t.apply( 5, 3 );", error is given saying that
"function test.apply(char c) is not callable".
---
For better testing, I added another function to template as
"public bool blah(){}", and called it in main, and it works. So,
thus this mean overloading is not supported with mixin templates?
template is mixed into that struct as follows.
private mixin template TestCommonMethods(){
public bool apply( int d, int e ){
return false;
}
}
public struct Test{
public mixin TestCommonMethods;
public bool apply( char c ){
return true;
}
}
void main(){
Test t;
t.apply( 5, 3 );
}
---
For the line "t.apply( 5, 3 );", error is given saying that
"function test.apply(char c) is not callable".
---
For better testing, I added another function to template as
"public bool blah(){}", and called it in main, and it works. So,
thus this mean overloading is not supported with mixin templates?