defaultvtable

定义一个接口作为 COM 对象的默认 vtable 接口。

[ defaultvtable( 
   interface 
) ]

参数

  • interface
    指定的接口要将默认 vtable 为 COM 对象。

备注

defaultvtable C++ 特性具有与 defaultvtable MIDL 属性相同。

示例

下面的代码演示如何使用 defaultvtable 指定默认接口在类的属性:

// cpp_attr_ref_defaultvtable.cpp
// compile with: /LD
#include <unknwn.h>
[module(name="MyLib")];

[object, uuid("00000000-0000-0000-0000-000000000001")]
__interface IMyI1 {
   HRESULT x();
};

[object, uuid("00000000-0000-0000-0000-000000000002")]
__interface IMyI2 {
   HRESULT x();
};

[object, uuid("00000000-0000-0000-0000-000000000003")]
__interface IMyI3 {
   HRESULT x();
};

[coclass, source(IMyI3, IMyI1), default(IMyI3, IMyI2), defaultvtable(IMyI1),
uuid("00000000-0000-0000-0000-000000000004")]
class CMyC3 : public IMyI3 {};

要求

属性上下文

适用对象

, struct

可重复

必需的特性

coclass

无效的特性

有关更多信息,请参见 属性上下文

请参见

其他资源

IDL 特性

类特性

Attributes Samples