If I understand correctly, every single COM object must inherit from the IUnknown interface, directly or indirectly. IUnknown is the very base building block of everything COM. Period.
Then, IUnknown itself is a mere interface with no implementation.
Speaking strict C++ OOP, IUnknown exposes pure virtual methods which you must override as you inherit from it.
Here are IUnknown's methods. Any interface inheriting from IUnknown must provide its own implementation for each:
- ::QueryInterface()
- ::AddRef()
- ::Release()
Any *other* interface inheriting from something even remotely inherited from IUnknown, must also re-implement IUnknown's 3 methods. And although it's syntactically possible to manually invoke the method implementation from any ancestor interface (that is, forward a call to any ancestor interface), it is Bad COM Design that is going to bite you eventually (I'm just not told how).
The bottom line is that you do not forward. You do override.
With all that said, I am currently wondering at how to implement my QueryInterface().
If I am forbidden to forward the call to my ancestor's QueryInterface() (to automagically support all its interfaces) then how do I get to enforce the support? My ancestor interface isn't written by me - and I can't look at its source. I can't guess by trial and error. That's no serious approach.
How do I discover which interfaces my ancestor supports, then?












