interface reference not compatible to Object?

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Sun Oct 22 01:53:27 PDT 2006


Walter Bright wrote:
> Frank Benoit (keinfarbton) wrote:
>> Is this the intended behaviour? If *every* object in D is a Object, then
>> every interface reference refers to an Object also.
>> This said, the above should compile?
> 
> Replace:
>     i.toHash();
> with:
>     (cast(Object)i).toHash();
> and it will work, *provided* that i is actually an instance of an
> Object. If it is not, for example if it came from some COM DLL, the cast
> will fail.

Is there much hope that the compiler will make the cast implicitly in
the future releases?



More information about the Digitalmars-d mailing list