override and interface methods

FeepingCreature feepingcreature at gmail.com
Mon Oct 29 14:29:50 UTC 2018


On Monday, 29 October 2018 at 13:44:03 UTC, Andrea Fontana wrote:
> On Monday, 29 October 2018 at 13:14:28 UTC, FeepingCreature 
> wrote:
>> When overriding a class method, you are required to specify 
>> `override`, indicating you are redefining existing behavior.
>>
>> When implementing an interface method, override *can* be used 
>> but doesn't *have to* be used. This seems quite ambiguous and 
>> confusing. Am I overriding a method here? If yes, I should be 
>> required to use it. If not, I should not be *allowed* to use 
>> it.
>>
>> Thoughts?
>
> In this case you have just one choice:
> https://run.dlang.io/is/4zWNED
>
> Andrea

Indeed, which suggests override should be required for interfaces 
as well.
This also seems to be the result of an informal poll in #d.


More information about the Digitalmars-d mailing list