Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wrote the code
C#
class Math
{
public int value1;
public int value2;
private int result;
public Math(int _value1, int _value2)
{
value1 = _value1;
value2 = _value2;
}
public void Add()
{
result = value1 + value2;
Thread.Sleep(1000);
Console.WriteLine("Add: " + result);
}
public void Subtract()
{
result = value1 - value2;
Thread.Sleep(1000);
Console.WriteLine("Subtract: " + result);
}
public void Multiply()
{
result = value1 * value2;
Thread.Sleep(1000);
Console.WriteLine("Multiply: " + result);
}
}


when i run this
everytime i am getting different output ...

VB
Add: 6
Subtract: 6
Multiply: 6


when i run again application i get

VB
Add: -1
Subtract: -1
Multiply:-1 


I am not able to understand the output
regards
Posted
Comments
Sushil Mate 12-Mar-12 7:14am    
what you want to achieve out of all this?

how you calling this class?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900