Compiler Error C3340
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3340.
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>
[module(name="MyModule")];
[ object, uuid(373a1a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface
{
HRESULT f1();
};
[ coclass, uuid(373a1a4d-469b-11d3-a6b0-00c04f79ae8f),
default(IMyIface),
source(IMyIface),restricted(IMyIface) ]
class CmyClass // C3340
{
};
int main()
{
}
Show: