On 2015年05月01日 06:30, Seth Fowler wrote: > >> On Apr 30, 2015, at 12:09 PM, Joshua Cranmer 🐧 <pidgeo...@gmail.com> wrote: >> >> do_QueryInterface is the equivalent of a type-checked downcast, e.g. >> (ClassName)foo in Java. (Regular C++ downcasts are not dynamically >> type-checked). > > do_QueryInterface is, in other words, essentially equivalent to dynamic_cast > in C++, except that because it’s implemented manually people can do strange > things if they want to. They almost never do, though, so dynamic_cast is a > pretty good mental model. > > - Seth >
Quoting Joshua, >> if you have A *x = new B, the static type of x is A whereas the dynamic type >> is B). do_QueryInterface() handles the XPCOM interface issues, though. I need to investigate a little more about how similar class/type objects can produce the difference between the set of XPCOM interfaces supported by A and the set of interfaes supported by B. I think my main question after the knowledge gained would be: Does inheritance of class inherits the XPCOM interfaces supported by the base class automatically? [Come to think of it, no I don't thinkso. XPCOM is an artificial framework tacked on C++. Or XPCOM interface in C++ is written in such a manner that they are automatically inherited?] Or do we have to manually and explicitly state that a set of interfaces are inherited (and of course, implemented, too)? Or considering the implementation issue, may the answer not be quite crystal clear (???) TIA _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform