Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Counting alligators..." + "\n");
            Countable Gator = new Alligator();

            Countutil.count(Gator, 3);


            Console.WriteLine( );
            Console.WriteLine("Counting the sheep...." + "\n");

            Countable sheep  = new Sheep();
            Sheep     sheep1 = new Sheep();

            sheep1.resetCount();
            sheep1.SheepsName("Blackie");
            Countutil.count(sheep1, 2);

            Console.WriteLine();


            Sheep sheep2 = (Sheep)sheep1.Clone();

            sheep2.resetCount();
            sheep2.SheepsName("Dolly");
            Countutil.count(sheep2, 3);


            Console.WriteLine();

            sheep1.resetCount();
            sheep1.SheepsName("Blankie");
            Countutil.count(sheep1, 1);
        }
Esempio n. 2
0
        public Object Clone()
        {
            resetCount();
            Sheep clone = new Sheep();

            return(clone);
        }