A renewed call for interface methods with bodies
Bill Baxter
dnewsgroup at billbaxter.com
Thu Jan 24 19:22:25 PST 2008
Burton Radons wrote:
> Robert Fraser Wrote:
>
>> There actually is a language issue: What if a class implements two
>> interfaces that both declare the same method, but the class doesn't?
>> Which one is called?
>>
>> BTW, I really need to stop checking this every 10 minutes...
>
> This is a problem whether or not the methods are implemented, and there's a mechanism in place to deal with it that I can't remember as it's never happened to me.
Yes, but in that case the resolution mechanism doesn't really have to
resolve anything. All the duplicated method pointers in the interfaces
all eventually point to the same single implementation in the class that
implements the interfaces.
If you allow interfaces to have implementations then I think the
compiler will have to enforce that any implemented methods have only one
implementor. Otherwise you've got plain old multiple inheritance and
you might as well just get rid of the 'interface' keyword.
--bb
More information about the Digitalmars-d
mailing list