Muokkaa

Jaa


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 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).

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);
}