[DUG] Interfaces

Todd Martin todd.martin.nz at gmail.com
Thu Aug 7 16:42:00 NZST 2008


Hi Alister

Are you implementing IXMLResidentialType via delegation?

Todd.
> I'm having some fun with interfaces
>
> I have two interfaces IXMLResidentialType and IAuctionable.
> I have a class which implements these two interfaces
> TXMLResidentialType = class(TXMLNode, IXMLResidentialType, IAuctionable) 
> ...
>
> I have some code
> var
>   Res : IXMLResidentialType;
>   Auctionable : IAuctionable;
> begin
> ...
>   if Res.QueryInterface(IAuctionable, Auctionable) = 0 then
>     ShowMessage('Auctionable');
>
> What I'm trying to determine is if Res implements IAuctionable - which 
> it does (through TXMLResidentialType which effective Res is an instance 
> of), however IXMLResidentialType doesn't seem to realise this.  How do I 
> make this work?
>
> Does this question make any sense?
>
> If I'm not able to do this it's not too much of a problem, but will mean 
> a bunch of duplicated code.
>
>
>   



More information about the Delphi mailing list