Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

defaultvtable

Defines an interface as the default vtable interface for a COM object.

[ defaultvtable( 
   interface 
) ]

interface

The designated interface that you want to have the default vtable for the COM object.

The defaultvtable C++ attribute has the same functionality as the defaultvtable MIDL attribute.

The following code shows attributes on a class that use defaultvtable to specify a default interface:

// 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 {};

Attribute Context

Applies to

class, struct

Repeatable

No

Required attributes

coclass

Invalid attributes

None

For more information, see Attribute Contexts.

Community Additions

ADD
Show:
© 2015 Microsoft