D interface bug?

Alex AJ at gmail.com
Fri Mar 29 23:44:35 UTC 2019


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! cBase is a super type so it contains 
everything iBase contains and maybe more.

There should be no reason why the compiler can't figure this out. 
It's a very simple rule.

Any time the user calls iBase.fooBase it can be replaced with 
cBase.fooBase so it should not compromise any code to go ahead 
and accept it as a proper override.




More information about the Digitalmars-d-learn mailing list