[Issue 1182] Mixins scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 24 03:21:58 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1182





------- Comment #3 from bugzilla at digitalmars.com  2007-04-24 05:21 -------
You can't do it with anonymous mixins, they have to be named.

import std.stdio;
template TestTemplate(T) {
    T policy(int i) { return T.init;}
    int policy() { return 1; }
}
class TestClass {
    mixin TestTemplate!(TestClass) foo;
    alias foo.policy policy;
    TestClass policy(int i) { return this; }
}
void main() {
    writefln((new TestClass).policy);
}


-- 



More information about the Digitalmars-d-bugs mailing list