method returning child, doesn't overrides declared method returning parent

Timon Gehr timon.gehr at gmx.ch
Tue Aug 30 04:56:13 PDT 2011


On 08/29/2011 10:24 PM, Jonathan M Davis wrote:
> On Monday, August 29, 2011 14:09 Mariusz Gliwiński wrote:
>> <code>
>> interface Interface {
>> Interface method();
>> }
>> class Class : Interface {
>> override Class method() {}
>> }
>> </code>
>>
>> DMD complains it isn't overriding. How should it be according to
>> specification, and how about making it legal?
>
> It's _not_ overriding. It's implementing an interface method. Those are two
> totally different things. And I think that it's horrible that Java considers
> implementing an interface method as overriding it. I'd _hate_ to see that in
> D.
>

+1

override should be required when there already is an implementation and 
disallowed when there is not.


More information about the Digitalmars-d mailing list