The fundamental elements of COM are the following:
Interfaces (especially IUnknown)
The QueryInterface method
Let's talk about each of these separately.
From an object-oriented programming standpoint, and also from the perspective of COM, an interface is a mechanism for exposing functionality, as I mentioned earlier. Typically, an object uses an interface to make its capabilities available to the outside world. When an object uses an interface, the object is said to implement that interface. Users of the object can interact with the interface without knowing what the object actually is, and a single object can implement multiple interfaces.
Generally speaking, to implement an ...