static void Main(string[] args)
{
Lion lion = new Lion();
Wolf[] wolves = new Wolf[5];//这是对象数组
for (int i=0;i
{
wolves[i] = new Wolf();
}
Console.WriteLine("我们现在一共有{}只狼", Wolf.WolvesCount);
//静态变量可以直接用类
for (int i = 0; i < wolves.Length; i++)
{
Console.Write("wolf{0}",i);
wolves[i].Act();
}
lion.Counterattack();
######Unhandled exception. System.FormatException: Input string was not in a correct format.
at System.Text.StringBuilder.FormatError()
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.IO.StreamWriter.WriteFormatHelper(String format, ParamsArray args, Boolean appendNewLine)
at System.IO.StreamWriter.WriteLine(String format, Object arg0)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object arg0)
at System.Console.WriteLine(String format, Object arg0)
at ConsoleApp_第28课以对象为成员_静态成员_.Program.Main(String[] args) in D:\练习\ConsoleApp(第28课以对象为成员、静态成员)\ConsoleApp(第28课以对象为成员、静态成员)\Program.cs:line 15
Console.WriteLine("我们现在一共有{0}只狼", Wolf.WolvesCount);