class Turns
{
private int number;
public void Counts(int getTurn, out int getBack)
{
if (getTurn.Equals(1))
{
number++;
}
getBack = number;
}
}
class Turns
{
private int number;
public void Counts(int getTurn, out int getBack)
{
if (getTurn.Equals(1))
{
number++;
}
getBack = number;
}
}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 26, 2013, 12:23 PM
When number was an instance field, it would start off at 0 for each instance.
However, when you changed it to static, it would start off at 0 for the class as a whole and would be incremented by 1 as each instance called the Count method.
Felice MassaroPosted May 26, 2013, 12:25 PM
Felice MassaroPosted May 26, 2013, 12:00 PM
I do not understand why for you the original one is working. Thats interesting.
VulpesPosted May 26, 2013, 11:55 AM