开发者

com object and interfaces

开发者 https://www.devze.com 2023-02-10 09:23 出处:网络
Wha开发者_开发技巧t is an interface connected to a com object?Each object implements one or more COM interfaces.

Wha开发者_开发技巧t is an interface connected to a com object?


Each object implements one or more COM interfaces.

A COM interface is a fixed description of what an object can do - in terms of C++ that's a class without member variables and with pure virtual member functions only. A COM class is an implementation of one or more interfaces - in terms of C++ it's a class (usually with member variables) with actually implemented member functions.

When you say that a COM class "has" some COM interfaces it means that it implements them and can retrieve a pointer to each of those interfaces - that's very similar to an upcast in terms of C++, but is done with IUnknown::QueryInterface() function of the actual COM class.


"COM Interfaces
The separation between service user and implementation is done by indirect function 
calls. A COM interface is nothing more than a named table of function pointers 
(methods), ..." 


See more information at The COM Programmer's Cookbook

0

精彩评论

暂无评论...
验证码 换一张
取 消