有没有更好的方法来做我正在做的事情:
class Sample {
int SampleValueX, SampleValueY;
string SampleFacing;
public Sample(int samplevaluex, string samplefacing)
{
SampleValueX = startpositionx;
SampleValueY = 0;
SampleFacing = samplefacing;
}
public Sample(int samplevaluey, string samplefacing)
{
SampleValueX = 0;
SampleValueY = startpositionx;
SampleFacing = samplefacing;
}
}
这甚至被称为构造函数重载吗?如果我错了,请纠正我。