[Issue 2157] [GSoC] mixin struct, function overload
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 17 18:12:08 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2157
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2011-12-17 18:12:05 PST ---
This is not an issue.
http://d-programming-language.org/template-mixin.html
> Mixin Scope
>
> The declarations in a mixin are ‘imported’ into the surrounding scope. If
> the name of a declaration in a mixin is the same as a declaration in the
> surrounding scope, the surrounding declaration overrides the mixin one:
^^^^^^^^^
If you want to merge overloads, you can add alias declaration to do it.
template T() {
int m_attr;
const {int attr() {return m_attr;}}
}
struct S {
mixin T t;
void attr(int n) {m_attr = n;}
alias t.attr attr; // Merge overloads
}
int main() {
const S s;
int r;
r = s.attr();
return r;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list