Object and interface compatibility

Frank Benoit (keinfarbton) benoit at tionex.removethispart.de
Sat Feb 10 09:19:15 PST 2007


Interfaces are NOT compatible to Object.

interface I{
 void func();
}
class C : I {
 void func(){}
}

void main(){
 I i = new C;
 i.func();                 // OK
 i.toHash();               // error !!
 (cast(C)i).toHash();      // OK
 (cast(Object)i).toHash(); // OK
}

I think this is a failure in the language design. What do you think?



More information about the Digitalmars-d mailing list