Originale-mail to me for new edition

 

Interface assignment-compatibility

 

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.

 

Topic groups

 

See also

Interface references

Type compatibility and identity: Overview

Variant types: Overview

 

 

译文

 

接口赋值兼容性

 

一个类类型与任何被该类实现的接口都是赋值兼容的。一个接口类型与该接口的任何祖先接口类型都是赋值兼容的。空指针值nil可以被赋给任何接口类型的变量。

接口类型的表达式可以被赋值给变体。如果接口的类型为IDispatch或其后裔,那么变体收到类型代码varDispatch,否则收到varIUnknown

类型代码为varEmptyvarUnknownvarDispatch的变体可以被赋值到IInterface变量。类型代码为varEmptyvarDispatch的变体可以被赋值到IDispatch变量。

 

主题组

 

相关主题

接口引用

类型兼容和等同:概述

变体类型:概述