[fpc-pascal] Casting descendant interface variables to base
Andrew Hall
andrew.hall at shaw.ca
Mon Jan 31 07:50:18 CET 2011
On 30 Jan 11, at 22:28 , cobines wrote:
> it is now a pointer to IBaseInterface, because of implicit QueryInterface?
The reference changes because you have explicitly cast (the implementing object) to another interface.
> So, I think I can compare interface variables but first I have to
> bring them to the same interface using "as", for example to IUnknown.
Yes. This function will confirm the two provided interfaces are implemented by the same object...
function EqIntf(a, b: IUnknown): Boolean;
begin
Result := (a as IUnknown) = (b as IUnknown);
end;
Regards Andrew.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110130/98eefc2d/attachment.html>
More information about the fpc-pascal
mailing list