Export (0) Print
Expand All
Expand Minimize

Compiler Error C3266

Error Message

'class' : a class-constructor must have a 'void' parameter list

Class-constructors in a class using /clr programming cannot take parameters.

The following sample generates C3266:

// C3266.cpp
// compile with: /clr

ref class X {
   static X(int i) { // C3266
   // try the following line instead
   // static X() {
   }
};

int main() {
}

The following sample generates C3266:

// C3266b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>

__gc class X {
   static X(int i) { // C3266
   // try the following line instead
   // static X() {
   }
};

int main() {
}

Community Additions

ADD
Show:
© 2014 Microsoft