Mixin template functions are ignored in struct
Daniel N via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Oct 14 19:37:25 PDT 2014
On Tuesday, 14 October 2014 at 20:58:19 UTC, tcak wrote:
> I have written a struct and a mixin template, and that mixin
> template is mixed into that struct as follows.
>
Use a normal mixin + token strings(q{}).
enum TestCommonMethods = q{
public bool apply( int d, int e ){
return false;
}
};
public struct Test{
mixin(TestCommonMethods);
public bool apply(char c){
return true;
}
}
void main(){
Test t;
t.apply( 5, 3 );
}
More information about the Digitalmars-d-learn
mailing list