How do I choose between E_NOTIMPL and E_NOINTERFACE?

c++, com, hresult, oop

Solution

If you failed to implement an entire interface, then your `QueryInterface` could explicitly return `E_NOINTERFACE`, so that nobody attempts to call any of its methods, or you could just make all of the methods could return `E_NOTIMPL` (it does actually make sense to do this in some edge cases). If you partially implement an interface, then you shouldn't return `E_NOINTERFACE` at all.

Problem

I have managed to confuse myself whether I should return `E_NOTIMPL` or `E_NOINTERFACE` from my COM server methods. I have a class with two functions I have overridden from the class I inherited from, both of those functions do nothing since they aren't really supported at the moment, so I ask should I use "not implemented" or "no interface" for these functions return values? Does anyone have a general rule of thumb of when to use each?

Original source