2017-05-27 18:10 GMT+02:00 Dennis Poon <den...@avidsoft.com.hk>:
>
>
> Sven Barth via fpc-pascal wrote:
>>
>> The idea itself is valid, cause "(IMyInterfaceVar as TObject) as
>> IMyInterface = IMyInterfaceVar" is true if and only if IMyInterface is
>> a COM interface. If IMyInterface really is a CORBA interface as Dennis
>> wrote then the compiler should already have complained at the "aObj :=
>> aInt as TObject" line as this type of conversion is*not*  supported by
>> CORBA interfaces (cause they don't provide QueryInterface() which is
>> needed for this). At least for me the compiler*did*  complain (both
>> 3.0.2 and 3.1.1) when I tested this.
>> So the question is: is IMyInterface indeed a CORBA interface? If so
>> then why does the compiler not complain? If not then why doesn't it
>> work? For both cases a full example would be needed to investigate
>> this.
>>
>> Regards,
>> Sven
>
> Sorry, I got it wrong. The interface was in fact COM style instead of CORBA.
>
> In case of COM interface, why
>
> var
>    aInt : IMyInterface;
>   aObj : TObject;
> begin
> ....
> ....
> ...
>    aInt := MyList.Items[0];
>
>    aObj := aInt as TObject;
>
> why sometimes (not always)   aInt  <>   (aObj as IMyInterface ) ?

Would you please provide a full, yet simple as possible example that
shows this? I can't reproduce it with merely code fragments as for me
it works.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to