Recently I study the book "Inside COM", and I find a code sample as below part: The Interface is defined as struct. The IX and IY inherit IUnknown. The CA class inherit IX and IY. As far as I know, in this case CA should have the two virtual point to the virtual functions, one belongs to IX and the other belongs to IY?
Interface IUnknown
{
virtual void QueryInterface() = 0;
virtual void AddRef() = 0
virtual void Release() = 0;
};
Interface IX : IUnknown
{
void X()
{
printf("X()\n");
}
};
Interface IY : IUnknown
{
void Y()
{
printf("Y()\n");
}
};
class CA : public IX, public IY
{
public:
void QueryInterface()
{
printf("QueryInterface()\n");
}
void AddRef()
{
printf("AddRef()\n");
}
void Release()
{
printf("Release()\n");
}
};
My question is why CA only implements QueryInterface(), AddRef(), Release() and the code can work. Why isn't there the ambiguous problem that the implementation of QueryInterface(), AddRef(), Release() belongs to IX or belongs to IY.
thanks.