Head-Spinning Continued: COM Interop    In my last column, I set
the scene for reusing some old C++ code from new Managed C++
code. The reuse technique that's received the most publicity and
coverage is COM Interop. In essence, any COM component can
appear to your managed code to be a managed object running in
the .NET Framework. In this column, I'll show you how to convert
an ordinary unmanaged class to a COM component, and then use
that COM component from both unmanaged and managed code.
Creating a COM Component  When you think COM and C++, I hope you
think ATL. The Active Template Library makes writing COM
components much simpler than it once was. You create an ATL
project, add an object to it, add an interface (or several) to
the object, and code the methods. If your "legacy library" was
many classes with many functions in each, you would probably
start by designing the interfaces, and then write your COM
component as a wrapper around the real classes: The wrapper
would hold an instance of one or more of