ATL uses CComCoClass to define the default class factory and aggregation model for your object. CComCoClass specifies the following two macros:
You can override either of these defaults by specifying another macro in your class definition. For example, to use CComClassFactory2 instead of CComClassFactory, specify the DECLARE_CLASSFACTORY2 macro:
class CMyClass : ...,
public CComCoClass<CMyClass, &CLSID_CMyClass>
{
public:
DECLARE_CLASSFACTORY2(CMyLicense)
...
};
Two other macros that define a class factory include DECLARE_CLASSFACTORY_AUTO_THREAD and DECLARE_CLASSFACTORY_SINGLETON.
ATL also uses the typedef mechanism to implement default behavior. For example, the DECLARE_AGGREGATABLE macro uses typedef to define a type called _CreatorClass, which is then reference throughout ATL. Note that in a derived class, a typedef using the same name as the base class's typedef results in ATL using your definition and overriding the default behavior.