Hello everyone,
Here is section of code I wrote about AddRef and Release. My questions are,
1. Are they correct code?
2. It looks redundant to call so many times of AddRef and Release just to make the counter consistent, if you were me, do you have ways to write better code?
Code:IX* pI = NULL;
pI = pI1;
pI -> AddRef();
...
pI -> Release(); // release before binding to a new interface
pI = pI2;
pI -> AddRef();
...
pI -> Release(); // release before binding to a new interface
pI = pI3;
pI -> AddRef();
...
thanks in advance,
George