Base class of all COM class is IUnkhown. It is an abstract base class having three abstract/virtual functions named:

  • QueryInterface(),
  • AddRef(),
  • Release()


  /* [in] */ REFIID riid,
  /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) = 0;

  virtual ULONG STDMETHODCALLTYPE AddRef( void ) = 0;
  virtual ULONG STDMETHODCALLTYPE Release( void ) = 0;

The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface() method, and manage the existence of the object through the AddRef() and Release() methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.
You must implement IUnknown as part of every interface. If you are using C++ multiple inheritance to implement multiple interfaces, the various interfaces can share one implementation of IUnknown. If you are using nested classes to implement multiple interfaces, you must implement IUnknown once for each interface you implement.

Methods in Vtable Order

  • QueryInterface - Returns pointers to supported interfaces.
  • AddRef - Increments reference count.
  • Release - Decrements reference count.

About our authors: Team EQA

You have viewed 1 page out of 67. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

Learn on Youtube