[Issue 2565] Should be able to use an inherited method as interface implementation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 4 17:42:57 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=2565
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #6 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-02-04 17:42:55 PST ---
(In reply to comment #5)
> but the means should be explicit.
This could be implementable via a mixin template, similar to how forwarding
constructors were proposed in Issue9066. A general-purpose template could be
written which could be used via:
mixin Forward!(BaseClass, "funcName");
And another template which uses it to fix this issue with:
class Foo : public FooImpl, public IFoo
{
mixin ImplementInterface!(IFoo, FooImpl);
// which expands to:
mixin Forward!(FooImpl, "foo");
mixin Forward!(FooImpl, "bar");
// which expands to:
override int foo() { return FooImpl.foo(); }
override int bar() { return FooImpl.bar(); }
}
Internally it would iterate through all IFoo interface functions and find the
matching implementations in FooImpl, and use `Forward` to mixin in a forwarding
function.
Or we would have language support. Anyway it should be doable as a library
solution for the time being.
--
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