Ejemplo n.º 1
0
        static void Main()
        {
            Alligator alligator = new Alligator();
            Sheep     sheep     = new Sheep();

            Console.WriteLine("Counting Alligators...\n");
            CountTestApp.DisplayCount(alligator);
            Console.Write("\n");
            Console.WriteLine("Counting Sheep...\n");
            CountTestApp.DisplayCount(sheep);
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static void DisplayCount(Sheep sheep)
        {
            CountUtil.Count(sheep, 2);
            Console.Write("\n");
            sheep.ResetCount();
            Sheep cloneSheep = (Sheep)sheep.Clone();
            int   count      = Validator.ValidateInt("We will now clone the sheep! How many clones do you want to make: ");

            Console.Write("We've cloned the sheep! Pick a new name: ");
            string name = Console.ReadLine();

            Console.Write("\n");
            cloneSheep.Name = name;
            CountUtil.Count(cloneSheep, count);
            Console.Write("\n");
            CountUtil.Count(sheep, 1);
        }