1.

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?

Answer»

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.

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.



Discussion

No Comment Found