The queryInterface() method is the entry point to obtain other interfaces which
are exported by the object. The caller asks the implementation of the object,
if it supports the interface specified by the type argument. The call may either
return with a interface reference of the requested type or with a void any.
There are certain specifications, a queryInterface() implementation must not violate.
1) If queryInterface on a specific object has once returned a valid interface reference
for a given type, it must return a valid reference for any successive queryInterface
calls on this object for the same type.
2) If queryInterface on a specific object has once returned a null reference
for a given type, it must always return a null reference for the same type.
3) If queryInterface on a reference A returns reference B, queryInterface on
B for Type A must return interface reference A or calls made on the returned
reference must be equivalent to calls made on reference A.
4) If queryInterface on a reference A returns reference B, queryInterface on
A and B for XInterface must return the same interface reference (object identity).
The reason for the strong specification is, that a Uno Runtime Environment (URE)
may choose to cache queryInterface() calls.
As mentioned above, certain language bindings may map this function differently also
with different specifications, please visit the language dependent specification for it.
The current C++ binding sticks to the specification state
The rules mentioned above are basically identical to the rules of QueryInterface in MS COM.