示例#1
0
        static void Main()
        {
            // Animal A = new Animal();

            Shark <int> S = new Shark <int>();

            S.Size        = 6;
            S.Name        = "Hammerhead";
            S.EatingHabit = "Carnivore";

            Console.WriteLine(S.GetName());
            Console.WriteLine(S.GetClassification());
            Console.WriteLine(S.GetHabitat());
            Console.WriteLine(S.GetEatingHabits());
            Console.WriteLine(S.Size);

            Shark <string> S2 = new Shark <string>();

            S2.Size        = "0.6096 - 1.524 meters";
            S2.Name        = "Bonnethead";
            S2.EatingHabit = "Omnivore";

            Console.WriteLine(S2.GetName());
            Console.WriteLine(S2.GetClassification());
            Console.WriteLine(S2.GetHabitat());
            Console.WriteLine(S2.GetEatingHabits());
            Console.WriteLine(S2.Size);

            Dog D = new Dog();

            D.Name = "Pekingese";
            //D.Size = 0.4; - inaccessible
            D.SetSize(0.4);

            Console.WriteLine(D.GetName());
            Console.WriteLine(D.GetClassification());
            Console.WriteLine(D.GetEatingHabits());
        }