static void Main(string[] args) { Army[] arrArmys = new Army[10]; arrArmys[0] = new Barbarian(); arrArmys[1] = new Giant(); arrArmys[2] = new Healer(); arrArmys[3] = new Healer(); arrArmys[4] = new Giant(); for (int i = 0; i < arrArmys.Length; i++) { if (null != arrArmys[i]) { arrArmys[i].Run(); System.Threading.Thread.Sleep(1000); } } System.Threading.Thread.Sleep(1000); for (int i = 0; i < arrArmys.Length; i++) { if (null != arrArmys[i]) { arrArmys[i].Attack(); System.Threading.Thread.Sleep(1000); } } }
static void Main(string[] args) { Army[] arrArmys = new Army[10]; arrArmys[0] = new Barbarian(); arrArmys[1] = new Giant(); arrArmys[2] = new Healer(); for (int i = 0; i < arrArmys.Length; i++) { if (null != arrArmys[i]) { arrArmys[i].Run(); } } for (int i = 0; i < arrArmys.Length; i++) { if (null != arrArmys[i]) { arrArmys[i].Attack(); } } }