我习惯用C++做这件事.这是不允许在C#中?
BasicCtor(int a)
{
return BasicCtor(a, "defaultStringValue");
}
BasicCtor(int a, string b)
{
//blah blah
}
Run Code Online (Sandbox Code Playgroud)
在C#中,我既不能返回构造函数的调用,也不会调用它来返回.C#允许我想做什么吗?:P
BasicCtor(int a) : this(a, "defaultStringValue")
{
}
BasicCtor(int a, string b)
{
//blah blah
}
Run Code Online (Sandbox Code Playgroud)