Default arguments are not supported
But you can attain the same effect through function overloading.The reason we prefer overloading as the solution to this problem is that it allows you, at a later time, to change the default value of a parameter without having to recompile existing client code. With C++ style default values, the defaults get burned into the client code, and you can therefore never change them once you've published an API.
But you can attain the same effect through function overloading.The reason we prefer overloading as the solution to this problem is that it allows you, at a later time, to change the default value of a parameter without having to recompile existing client code. With C++ style default values, the defaults get burned into the client code, and you can therefore never change them once you've published an API.
{
private int j;
public ss():this(0)
{
}
public ss(int j)
{
this.j=j;
}
private void ss(int i)
{
}
private void ss()
{
this.ss(0);
}
}
0为默认值
{
public myclass()
{ }
public string FnGetstr(string strName="senes")
{
return strName;
}
}