Hello everyone,
I am reading Unknwn.h, and the code logics is a little fuzzy. The QueryInterface, AddRef an Release are all pure virtual methods, right?
thanks advance,
George
Printable View
Hello everyone,
I am reading Unknwn.h, and the code logics is a little fuzzy. The QueryInterface, AddRef an Release are all pure virtual methods, right?
thanks advance,
George
That's right. IUnknown is part of a framework known as COM. Basically, all interfaces inherit from IUknown which means you can call any of those 3 functions on any interface (or object which inherits from those interfaces).
AddRef() and Release() are just functions for reference counting. QueryInterface() allows you to find out what interface anything else inherits from at runtime.
Even though COM was created by Microsoft, a lot of other people use the same principals in their framework. My company does the same thing; we have a common interface with the same 3 virtual functions.
Reading COM header files won't get you anywhere. Read a good COM tutorial instead.