Upcasts in COM automatic?
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.
精彩评论