Question about template mixins as nested functions.
gobstocker at gmail.com
Thu Feb 15 21:31:07 PST 2007
I have a question about using a template mixin to add a nested function
to a class method, when the nested function references class member
variables. For example:
mixin HelperFunction; // see below
localVar++; // This works fine
memberVar++; // Error: need 'this' to access member memberVar
I'm not sure why the mixed-in nested function can't access member
variables of the enclosing class (it works if I just write the nested
function directly inside the class method). Is this a bug, or (more
likely) have I not fully grasped the ins and outs of using template mixins?
More information about the Digitalmars-d-learn