Condividi tramite


CComPtrBase::Attach

Call this method to take ownership of an existing pointer.

void Attach( 
   T* p2  
) throw( );

Parameters

  • p2
    The CComPtrBase object will take ownership of this pointer.

Remarks

Attach calls CComPtrBase::Release on the existing CComPtrBase::p member variable and then assigns p2 to CComPtrBase::p. When a CComPtrBase object takes ownership of a pointer, it will automatically call Release on the pointer which will delete the pointer and any allocated data if the reference count on the object goes to 0.

Requirements

Header: atlcomcli.h

See Also

Reference

CComPtrBase Class

CComPtrBase::Detach