// Create a new COM object IUnknown* pNewObj = CreateInstanceOfSomeCOMObject(); // Create a new COMPtr object and transfer ownership of the COM object COMPtrIn this example, we created a new COM object and transferred its ownership to a `COMPtr` object. The `COMPtr` object will call `Release` method of the underlying COM object when it goes out of scope. The package/library that provides `COMPtr` and `adoptRef` is likely to be a COM library or framework, as these are specific to COM object management. It could be any library that provides COM support, such as ATL, WTL, or MFC.pObj; pObj.adoptRef(pNewObj);