I have the following hierarchy of COM interfaces and a class implementing them:
interface IX : public IUnknown{};
interface IY : public IUnknown{};
class CA: public IX, public IY{};
Here class CA
effectively inherits from IUnknown
twice.
We know there are two vtable pointers in class CA
- one is pointed to IX
and another is pointed to IY
. So IUnknown
stored in the IX
subobject is different from IUnknown
stored in the IY
subobject.
Yet when we call IX::QueryInterface()
or IY::QueryInterface()
on the same object and query IUnknown
we get identical IUnknown*
pointers.
Why does it happen?