2009年7月2日 星期四

interface and class of com

A COM interface is a set of related methods that have a well-defined contract but have no implementation. A COM class implements one or more interfaces, and all the services a COM class exports are defined by the interfaces it implements. Callers access the services of a COM object by calling the methods defined by its interfaces.

an interface is an abstract class that defines a set of public, pure virtual functions and contains no data members.

ex:
class IUnknown {
public:
virtual HRESULT QueryInterface(REFIID riid, void** ppv) = 0;
virtual unsigned long AddRef() = 0;
virtual unsigned long Release()= 0;
};

沒有留言: