In the following C++ code (from a Microsoft COM header file), what is the part that starts with template<class Q>...
?
I am thoroughly confused for other reasons as well, as although a struct
is in use, it has class-like elements; for example, the public
keyword.
extern "C++" {
struct IUnknown {
public:
virtual HRESULT WINAPI QueryInterface(REFIID riid,void **ppvObject) = 0;
virtual ULONG WINAPI AddRef(void) = 0;
virtual ULONG WINAPI Release(void) = 0;
template<class Q> HRESULT WINAPI QueryInterface(Q **pp) { return QueryInterface(__uuidof(*pp),(void **)pp); }
};
}