共用方式為


CComAggObject Class

This class implements the IUnknown interface for an aggregated object. By definition, an aggregated object is contained within an outer object. The CComAggObject class is similar to the CComObject Class, except that it exposes an interface that is directly accessible to external clients.

template< 
   class contained 
> 
class CComAggObject : 
   public IUnknown, public CComObjectRootEx 
   < contained::_ThreadModel::ThreadModelNoCS >

Parameters

Members

Public Constructors

Name

Description

CComAggObject::CComAggObject

The constructor.

CComAggObject::~CComAggObject

The destructor.

Public Methods

Name

Description

CComAggObject::AddRef

Increments the reference count on the aggregated object.

CComAggObject::CreateInstance

This static function allows you to create a new CComAggObject< contained > object without the overhead of CoCreateInstance.

CComAggObject::FinalConstruct

Performs final initialization of m_contained.

CComAggObject::FinalRelease

Performs final destruction of m_contained.

CComAggObject::QueryInterface

Retrieves a pointer to the requested interface.

CComAggObject::Release

Decrements the reference count on the aggregated object.

Public Data Members

Name

Description

CComAggObject::m_contained

Delegates IUnknown calls to the outer unknown.

Remarks

CComAggObject implements IUnknown for an aggregated object. CComAggObject has its own IUnknown interface, separate from the outer object's IUnknown interface, and maintains its own reference count.

For more information about aggregation, see the article Fundamentals of ATL COM Objects.

Inheritance Hierarchy

CComObjectRootBase

CComObjectRootEx

IUnknown

CComAggObject

Requirements

Header: atlcom.h

See Also

Reference

CComObject Class

CComPolyObject Class

DECLARE_AGGREGATABLE

DECLARE_ONLY_AGGREGATABLE

DECLARE_NOT_AGGREGATABLE

Other Resources

ATL Class Overview