Broken?

Kapps opantm2+spam at gmail.com
Thu Mar 13 00:21:25 PDT 2014


On Wednesday, 12 March 2014 at 11:59:45 UTC, Paulo Pinto wrote:
> On Wednesday, 12 March 2014 at 11:40:39 UTC, Manu wrote:
>
> It can also happen the other way if I mark a method virtual 
> that used to be final, which was overloaded in a subclass, 
> right?
>
> --
> Paulo

Not really. The way C# handles it (and I assume the way D would 
as well) is that shadowing a virtual method is a warning. If Bar 
derives from Foo and implements foobar(int), then at some point 
Foo decides to add foobar(int), Bar's foobar(int) will not be 
virtual but a warning will be given that it shadows 
Foo.foobar(int). You can then either mark it override, or you can 
mark it new to indicate that you are aware it shadows the method 
and don't want to overload it. So going from final to virtual is 
not a breaking change (but you will receive a warning until you 
acknowledge that you're shadowing the method), but going from 
virtual to final is a breaking change.


More information about the Digitalmars-d mailing list