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

Christophe travert at phare.normalesup.org
Tue Aug 30 06:01:46 PDT 2011


I'm not sure what I am talking about (I have never used interfaces so 
far), but if a interface developper adds a method foo, she expects every 
developper of derived class to get an error because they don't implement 
this new method yet.

But if a derived class unfortunately already has a method called foo. 
The developped of the derived class will not be aware that the interface 
has changed, and his method foo is propably not what is expected by the 
interface developper. The compiler will not complain about the absence 
of the override (or implement?) keyword. This may be a serious problem. 
The only solution is to never add new interface methods without 
providing default solutions for these methods.

-- 
Christophe




More information about the Digitalmars-d mailing list