I've got a problem with the following code:
public class Player
{
public int money;
public void setMoney(int amount)
{
money = amount;
}
}
public void init()
{
Player Player1 = new Player();
}
public void main()
{
Player1.money = 9001;
}
private void mainForm_Load(object sender, EventArgs e)
{
init();
main();
}
When I run the given code I get an error that Player1 was not available in that context. So I guess i can't create an Player object in init and then use it in main.
How can I solve that problem?
Regards, dncrft