override and interface methods

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


On Monday, 29 October 2018 at 14:39:59 UTC, Andrea Fontana wrote:
> I don't think a poll with three answers is so relevant :)
>
> They say it should be required.
>
> Anyway if  class A : AnInterface { ... } it isn't actually 
> override anything, because AnInterface is just an interface. 
> Class A is just implementing a method.
>
> So probably you should not use override if you're not 
> overriding something.
>
> Andrea

I agree that it's not overriding anything, but it also makes 
little sense to add a new keyword "implement" that is used as a 
1:1 stand-in for override for interface methods, and in any case 
what would you do in the class/interface case: "override 
implement void foo()"? And besides, override is *already* 
permissible for interface implementations, so it already means 
"override or implement". I'm just asking for some consistency.


More information about the Digitalmars-d mailing list