Udostępnij za pośrednictwem


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 delete the pointer and any allocated data when it goes out of scope.

Requirements

Header: atlcomcli.h

See Also

Reference

CComPtrBase Class

CComPtrBase::Detach

Other Resources

CComPtrBase Members