l QueryInterface requires transitive and reflexive
properties:
nsCOMPtr<nsIFoo> foo = do_CreateInstance(…);
nsCOMPtr<nsIBar> bar = do_QueryInterface(foo);
nsCOMPtr<nsIFoo> foo2 = do_QueryInterface(bar);
// guarantee is that foo == foo2
l InterfaceRequestor does not follow this:
nsCOMPtr<nsIFoo> foo = do_CreateInstance(…);
nsCOMPtr<nsIBar> bar = do_GetInterface(foo);
// these calls may or may not fail, or may return different
objects
nsCOMPtr<nsIFoo> foo2 = do_GetInterface(bar); // ??
nsCOMPtr<nsIfoo> foo3 = do_QueryInterface(bar); // ??
12
Alec Flett
2/11/2002