Hello everyone,
In the book "Inside COM", there is an interesting code segment like this,
My question is, why static_cast <IX*> to result in IUnknown*? Why not static_cast <IUnknown*> to result in IUnknown* to be more straightforward (even if I think using IX* and IUnknown* have the same effect)? Are there any reasons or advantages if we use IX* other than IUnknown*?Code:IUnknown* CreateInstance()
{
IUnknown* pI = static_cast <IX*> (new CA);
pI -> AddRef();
return pI;
}
// IX an interface is derived from IUnkown, IY is an interface derived from
// IUnknown and CA is a class directly derived from both IX and IY.
thanks in advance,
George