Пример #1
0
        static void Main(string[] args)
        {
            Alligator gator = new Alligator();

            Console.WriteLine("Counting Alligators...");
            Console.WriteLine("");
            CountUtil.count(gator, 3);

            Sheep sheep1 = new Sheep();

            Console.WriteLine("");
            Console.WriteLine("Counting Sheep...");
            Console.WriteLine("");

            sheep1.setName("Blackie");
            CountUtil.count(sheep1, 2);
            Console.WriteLine("");
            Sheep clone = (Sheep)sheep1.Clone();

            clone.setName("Dolly");
            CountUtil.count(clone, 3);
            Console.WriteLine("");
            CountUtil.count(sheep1, 1);

            Console.ReadLine();
        }
Пример #2
0
        public object Clone()
        {
            resetCount();
            Sheep clone = new Sheep();

            return(clone);
        }