Is there a better way to do what I am doing:
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;
}
}
Is this even known as constructor overloading? Correct me if I am wrong.
You can use optional parameters
Note that the optional parameters must appear after the mandatory ones