public static void Main() { Child a; Parent b; int i; List<Parent> Parents = new List<Parent>(); for (i = 1; i <= 2; i++) { a = new Child(i, 2 * i, 3 * i); Parents.Add(a); } for(i = 0; i < Parents.Count; i++) { b = Parents[i]; Console.WriteLine(b.OutString()); Console.WriteLine("Length: {0} ", b.Sum); } for(i = 0; i < Parents.Count; i++) { a = (Child) Parents[i]; Console.WriteLine(a.OutString()); Console.WriteLine("Length: {0}", a.Sum); } Console.ReadLine(); }
public void run() { Child child1 = new Child(); Child child2 = new Child(); child1.name = ("Rob"); child2.name = ("Jan"); child1.DisplayStatus(); child2.DisplayStatus(); child1.DisplayHappyiness(); child2.DisplayHappyiness(); Console.WriteLine("Running the game"); }