【发布时间】:2016-03-13 01:38:05
【问题描述】:
我试图引用在方法中创建的对象。
这是 Main 方法。
static void Main(string[] args)
{
//call all cube base details into existance.
callCubes();
//Test Output
Console.WriteLine("Name: " + blank.name);
Console.WriteLine("Health: " + blank.health);
Console.WriteLine("Attack: " + blank.attack);
Console.WriteLine("");
Console.ReadKey();
}
这是callCubes 方法。
static void callCubes()
{
cube blank = new cube();
blank.base_stats(00, "Blank", 0, 0, 0, 0, 0, 0.00); //id, name, atk, def, speed, sp. atk, sp. def, health
blank.ev_stats(0, 0, 0, 0, 0, 0.00); //atk, def, speed, sp. atk, sp. def, health
blank.moveSet(00, 00, 00, 00);//move1, move2, move3, move4
}
当我在第一行调用 callCubes 时,我无法弄清楚为什么在当前上下文中没有定义空白。
编辑:https://github.com/Mooseymax/Pocket-Cube/blob/master/source%20cs/Program.cs
【问题讨论】: