This documentation is archived and is not being maintained.

Compiler Error C3380

'class' : invalid assembly access specifier - only 'public' or 'private' are allowed

When applied to a managed class or struct, the public and private keywords indicate whether the class will be exposed via assembly metadata. public or private can only be applied to a class in a program compiled with /clr.

The following keywords, when used with /clr, indicate that a class is managed:

The following sample generates C3380:

// C3380.cpp
// compile with: /clr
#using <mscorlib.dll>
protected __gc class A {   // C3380. Remove protected keyword.
   static int i = 9;

int main() {
   A *myA = new A;