Delen via


Don't believe me? Just ask Larry.

QueryInterface isn't a particularly controversial topic (and I haven't heard any grumbling about my last post) but I always invite you to verify everything I say on your own--partly to ensure that mistakes I make don't make their way too far into the wilderness*, but mostly because I think you'll understand the concepts best if you do a bit of digging and pick up the details from another author's perspective.

So if you want another explanation about the QueryInterface post I put together, you can read all about it on Larry Osterman's blog.  His example is a little more subtle in that it deals with fragility in inherited interfaces (mine is simpler and deals with inheriting multiple unrelated interfaces in a single object), and he gets into the actual vtable implementation, but the moral of the story is the same: use QueryInterface.

Larry is a long-time developer at Microsoft, so any errors present in both my post and his post are either really obscure, or really well-ingrained Microsoftisms.  Or both.

* To be clear, I do put a lot of effort into double-checking the facts to ensure you're getting high-quality posts.  But errors can always inadvertently creep in, and I haven't developed enough of an ego to lie about that.