interface reference not compatible to Object?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Oct 21 12:54:03 PDT 2006


Max Samuha wrote:
> On Sat, 21 Oct 2006 15:11:59 +0200, Frits van Bommel
> <fvbommel at REMwOVExCAPSs.nl> wrote:
> 
>> Frank Benoit (keinfarbton) wrote:
>>> Wouldn't it be consistent if the compiler implicitly inherit all
>>> interfaces without a super-interface from this IObject?
>> Maybe Object itself as well?
>> That way functions can accept any object (whether referenced by class or 
>> interface) as an IObject.
>>
>> Though I would prefer it if all interface references would just be 
>> implicitly convertible to Object. Java does this, IIRC.
> 
> The problem is that not all objects in D are D objects. An interface
> may be a com interface that cannot be cast to Object or inherit from
> IObject. It was discussed somewhere in the NG, IIRC

Can non-COM interfaces be implemented by COM objects? (I'm pretty sure 
they at least can't be implemented by non-d objects, so does it matter?)

Since whether an interface is a COM interface can easily determined 
(they inherit from std.c.windows.com.IUnknown) can't we at least make it 
so that all non-COM interfaces are convertible to Object?



More information about the Digitalmars-d mailing list