ATL's support for building COM objects is separated into several layers, as shown in Figure 4.1.
Figure 4.1. The layers of ATL
These layers break down into services exposed by ATL for building objects:
Your choice of base classes and the most derived class determines the way the methods of IUnknown are implemented. If your choices change, using different classes at compile time (or runtime) will change how ATL implements IUnknown, independently of the rest of the behavior of your object. The following sections explore each layer of ATL.