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
Expand Minimize
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.

Compiler Error C3340

Error Message

'interface': interface cannot be both 'restricted' and 'default' in coclass 'class'

The restricted attribute and the default attribute are mutually exclusive.

The following sample generates C3340:

// C3340.cpp
#include <windows.h>

[ object, uuid(373a1a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface
   HRESULT f1();

[ coclass, uuid(373a1a4d-469b-11d3-a6b0-00c04f79ae8f),
source(IMyIface),restricted(IMyIface) ]
class CmyClass // C3340

int main()

Community Additions

© 2015 Microsoft