Answers

Question and Answer:

  Home  COM DCOM

⟩ Suppose we have object B and aggregated object C (in- proc server), created by B. Can you access any interface of B from C? What?s the difference between aggregated and contained objects?

For the first question, Yes, we can since the QueryInterface

() rules of thumb suggest that if we can query an interface

of C from B, we should be able to query the viceversa.

The IUnknown implementation of both the objects has to do

the 'magic'.

For the second question, Aggregation bounds outer and inner

objects together and gives the user the interface pointers

of either objects to access it directly so that the user

never knows the objects are aggregated.

But when containment is used, the interface of inner object

never exposed to the client directly rather the outer

object receives the calls and forwards internally. Here

also, the user doesn't know the objects are contained.

 219 views

More Questions for you: