看完com本质论第一章

class IUnKnown

{

virtual void QueryInterface(REFIID riid,IUnknown** ppv)=0;

virtual void addref()=0;

virtual void release()=0;

}

void QueryInterface(REFIID riid,IUnknown** ppv)

{

if(riid==IID_ITest)

*ppv = static_cast<IPug*>(this);

else {

*ppv=0;

return E_NOINTERFACE;

}

reinterpret_cast<IUnknown*>(*ppv)->AddRef();

return S_OK;

}

你可能感兴趣的:(com)