开发者

Upcasts in COM automatic?

开发者 https://www.devze.com 2022-12-09 11:03 出处:网络
I开发者_如何学编程n COM, if I have an interface IBase and an interface IX which inherits from IBase, can I call methods of IBase through an IX pointer, and if not, why can I call Release() and AddRef(

I开发者_如何学编程n COM, if I have an interface IBase and an interface IX which inherits from IBase, can I call methods of IBase through an IX pointer, and if not, why can I call Release() and AddRef() on any COM interface pointer without an upcast?


Yes, you can call whatever method of the base through the pointer to the derived. That's exactly why you can call AddRef(), Release() and QueryInterface() through any interface pointer.

0

精彩评论

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