COM interfaces have several facets. First, an interface is a deferred class ("abstract class" in C++ terms). This means that an interface is a specification of a type. Second, an interface pointer represents a COM object, which is callable by a client application. An object can expose several interfaces, or represent several types.
For each interface listed in a type library, the EiffelCOM wizard generates a deferred class and two effective classes: a proxy of an interface pointer, or a client side class, and a stub of an interface pointer, or a server side class. The deferred interface class inherits from
ECOM_INTERFACE holds a pointer to the underlying COM interface.
Different languages handle type coercion or type narrowing in different ways. C uses type cast; C++ introduces several type casting mechanisms; Eiffel uses object test, etc. Every COM interface exposes the
make_from_other (other: ECOM_INTERFACE)
which queries a COM component internally. Every interface proxy class inherits from ECOM_QUERIABLE. An important difference between this mechanism and using an object test is that if the creation routine fails to initialize a new ECOM_QUERIABLE object, an exception will be raised, whereas, the
False result in the case in which no object of the desired type is available.