Re: Interface Question





On Oct 9, 1:24 pm, "Maarten Wiltink" <maar...@xxxxxxxxxxxxxxxxxx>
wrote:
<alangll...@xxxxxxx> wrote in messagenews:1160386781.998311.103960@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[...]

Now IShellLink has _none_ of the methods of IPersist or IPersistFile,
so _how_ can an IShellLink be typecast to an IPersistFile.The actual object may implement both the (disjoint) lists.

They are not totally disjoint, by the way. Both include the methods
inherited from IUnknown. It's like Destroy; every object can be
Destroyed because they're all TObjects. All interfaces can be cast
to other interfaces because they all include IUnknown.QueryInterface.

                                                           Or is the
COM object of ObjectIF somehow re-created as an IPersistFile when
type-cast as such.
The object is never re-created. If I understand correctly, an interface
reference points to a VMT-like structure that includes the methods
prescribed by the interface. A classtype that implements multiple
interfaces simply builds several such tables from its 'master' VMT.


Thanks Martin.

I can understand how a Delphi classtype can readily implememnt multiple
interfaces, but this is an MS interface, does the same thing happen
there. And how does one know (except by trial & error, or rumour) that
an interface implements multiple interfaces. Or is that hidden in MS
exotic information. It doesn't appear to be in MSDN.

I can see that a multiple-interface class-type could have its
Delphically-overridden QueryInterface method set up a pseudo-VMT for a
typecast interface which has been implemented. The whole problem seems
to me to be the knowledge of an object's multiple interfaces. But I
suppose that if its _not_ a multiple interface implementing object,
then QueryInterface returns an error.

Alan Lloyd

.



Relevant Pages

  • Re: dhcp Server startet nicht mehr (Solaris)
    ... dass der Script killfalsch aufruft und daher ... > Multiple interfaces match the same shared network: ...
    (de.comp.os.unix.networking.misc)
  • Re: Clustering - how can I.......
    ... Failsafe IP allows a system with multiple interfaces (that is, ... adapters) to recover from the failure of any single adapter. ...
    (comp.os.vms)
  • Re: Java and OOP
    ... (extending more than one superclass). ... People would generally use multiple interfaces and/or delegation to accomplish the same ends. ... The use of interfaces is to establish a contract for the implementation class, and also because you can refer to an instance of such an implementing class by an interface type that it implements. ... Generics provide another powerful tool for type analysis and programming. ...
    (comp.lang.java.programmer)
  • QueryInterface woes with multiple interfaces (only one dispinterface)
    ... One is a dispinterface that is ... interfaces) used among my objects for inter-object communication. ... If I look at the object's type library, the multiple interfaces show up ... But if I QueryInterface a proxy, ...
    (microsoft.public.vc.atl)