A class type is
assignment-compatible with any interface type implemented by the class. An
interface type is assignment-compatible with any ancestor interface type. The
value nil can be assigned to any interface-type variable.
An interface-type expression can
be assigned to a variant. If the interface is of type IDispatch or a
descendant, the variant receives the type code varDispatch. Otherwise,
the variant receives the type code varUnknown.
A variant whose type code is varEmpty, varUnknown, or varDispatch can be assigned to an IInterface variable. A variant whose type code is varEmpty or varDispatch can be assigned to an IDispatch variable.
Type compatibility and identity: Overview
一个类类型与任何被该类实现的接口都是赋值兼容的。一个接口类型与该接口的任何祖先接口类型都是赋值兼容的。空指针值nil可以被赋给任何接口类型的变量。
接口类型的表达式可以被赋值给变体。如果接口的类型为IDispatch或其后裔,那么变体收到类型代码varDispatch,否则收到varIUnknown。
类型代码为varEmpty、varUnknown或varDispatch的变体可以被赋值到IInterface变量。类型代码为varEmpty或varDispatch的变体可以被赋值到IDispatch变量。