Compiler Error C3222

  • Thread starter Thread starter Daniel =?iso-8859-1?Q?Lidstr=F6m?=
  • Start date Start date
D

Daniel =?iso-8859-1?Q?Lidstr=F6m?=

Compiler Error C3222'parameter' : cannot declare default arguments for
member functions of a managed type

Arrrgggghhhhh!
 
Here us what you can do, say you have the situation like in MS sample:

// C3222.cpp
// compile with: /clr
#using <mscorlib.dll>
public __gc class G
{
void f( int n = 0 ); // C3222
};You can workaround this problem by adding overloaded member function with
no parameters and call the original function from there:

// NoC3222.cpp
// compile with: /clr
#using <mscorlib.dll>
public __gc class G
{
void f( int n );
void f(void);
};

void G::f(int n){
//do something with n here
}

void G::f(){
f(100);
}
 
Back
Top