共用方式為


DECLARE_AGGREGATABLE

 

Specifies that your object can be aggregated.

Syntax

      DECLARE_AGGREGATABLE( 
   x  
)

Parameters

  • x
    [in] The name of the class you are defining as aggregatable.

Remarks

CComCoClass contains this macro to specify the default aggregation model. To override this default, specify either the DECLARE_NOT_AGGREGATABLE or DECLARE_ONLY_AGGREGATABLE macro in your class definition.

Example

class ATL_NO_VTABLE CNoAggClass :
   public CComObjectRoot,
   public CComCoClass<CNoAggClass, &CLSID_NoAggClass>
{
public:
   CNoAggClass()
   {
   }

   DECLARE_NOT_AGGREGATABLE(CNoAggClass)
};

Requirements

Header: atlcom.h

See Also

Aggregation and Class Factory Macros
ATL Macros