OOPortal OOPortal


COM Aggregation   «Prev 

Reference counting

 Reference counting declares an HRESULT to use for COM return values
Reference counting - Declares an HRESULT to use for COM return values.

Line 1 Declares an HRESULT to use for COM return values.
Line 2 Declares a pointer to interface IF2.
Line 3 The client creates an instance of OuterCOMObj asking for a pointer to IF2. The client thinks IF2 is implemented in OuterCOMObj, that is, the aggregated component is not visible to the client. As part of its start-up sequence, OuterCOMObj creates an instance of InnerCOMObj. A pointer to IF2 is returned to the client in pIF2.
Line 9 Checks to return status of CoCreateInstance.
Line 11 Assumes we make a series of successful calls into interface IF2.
Line 13 Releases interface IF2.