On Friday, 29 March 2019 at 23:44:35 UTC, Alex wrote: > interface iBase > { > iBase fooBase(iBase); > } > > > class cBase : iBase > { > cBase fooBase(cBase c) { return c; } > > } > > cBase.fooBase should be a valid override of iBase.fooBase > because > they are the same type!
The return value there is allowed, but the parameter is not. Consider this case: class AnotherChild : iBase { /* snip */ } iBase i = new cBase(); // allowed, cBase implements iBase i.fooBase(new AnotherChild); That second line should be allowed: the interface says it accepts any implementation of the iBase interface. But the cBase implementation doen't allow *any* implementation of iBase - it only accepts cBase and down. That function wouldn't be able to handle my AnotherChild instance. Thus, cBase.fooBase does NOT implement the iBase's interface, and it fails to compile.