Okay, another question, if you don't mind. You've got your tIUnknownVTable UDT, and you're using it twice.

First, you're using it in CBaseClass_CBaseClass for the Static tVtable.

Second, you're using it in the CSumDiff UDT.

Now, when CreateSumDiffObject is called, it calls CSumDiff_CSumDiff with tObj(0) (which is CSumDiff). And then CSumDiff_CSumDiff calls CBaseClass_CBaseClass with tObj.CBase (which is tIUnknownVTable).

So, to summarize, CBaseClass_CBaseClass creates your IUnknown VTable, and also sets your lRefCounter to zero. And then CSumDiff_CSumDiff creates your CSumDiff VTable which has another instance of the IUnknown VTable in it.

Also, when you're done with CSumDiff_CSumDiff, you set the tObj.CBase.pVtbl = VarPtr(tVtable), changing it from what CBaseClass_CBaseClass set it to.

So, I'm thinking that, other than setting the lRefCounter to zero, we don't need the call to CBaseClass_CBaseClass. After CSumDiff_CSumDiff changes tObj.CBase.pVtbl to point at the new VTable, the old tIUnknownVTable is orphaned.

Is my thinking somehow wrong?

Thanks,
Elroy