Export (0) Print
Expand All
Expand Minimize

Compiler Error C3380

Error Message

'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 through assembly metadata. Only public or private can be applied to a class in a program compiled with /clr.

The ref and value keywords, when used with /clr, indicate that a class is managed (see Classes and Structs (Managed)).

The following sample generates C3380:

// C3380_2.cpp
// compile with: /clr
protected ref class A {   // C3380
// try the following line instead
// ref class A {
public:
   static int i = 9;
};

int main() {
   A^ myA = gcnew A;
   System::Console::WriteLine(myA->i);
}

The following sample generates C3380:

// C3380.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
protected __gc class A {   // C3380
// try the following line instead
// __gc class A {
public:
   static int i = 9;
};

int main() {
   A *myA = new A;
   Console::WriteLine(myA->i);
}

Community Additions

ADD
Show:
© 2014 Microsoft