> Neven MacEwan quite correctly points out:
>
> > You can also delegate the inplemenation of an interface in delphi
> <snippage>
> > ie
> >
> > TClassC - class(TClassA, InterfaceB)
> > private
> >   FClassB: TClassB
> > property
> >   InstClassB read FClassB write FClassB implements InterfaceB
> > end
>
> But if you are doing any COM work you must be extremely careful using this
> sort of mechanism. There is a assumption in COM that objects being the
same
> can be checked by comparing the IUnknowns of two interfaces to see if they
> are the same. So in the above example casting to InterfaceB and then to
> IUnknown must produce the same result as just casting to IUnknown. See
> http://www.techvanguards.com/com/tutorials/tips.asp point 12 for a more
> detailed explanation.
>

The example at that site is talking about a property which actually returns
the interface whereas Neven's example has a property which returns an object
(which presumably implements the interface). Does the problem still apply in
this situation under Delphi 5? That is, when you have
ClassC.QueryInterface(InterfaceB) does this return the interface from the
TClassB object rather than an interface which is associated with the TClassA
object?

Seems to me it depends on how Delphi is choosing to do the internals of the
implements keyword and it would certainly be interesting to know.

David.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to