示例#1
0
        static void Main(string[] args)
        {
            Bear    b = new Bear();
            Chicken c = new Chicken();
            Eagle   e = new Eagle();

            AnimalUtility.DoSomething(b);
            AnimalUtility.DoSomething(c);
            AnimalUtility.DoSomething(e);

            //pause
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Bear bear = new Bear();

            bear.Name = "Brown Bear";

            Eagle eagle = new Eagle();

            eagle.Name = "Bald Eagle";

            Chicken chicken = new Chicken();

            chicken.Name = "Rooster";

            AnimalUtility.DoSomething(bear);
            AnimalUtility.DoSomething(eagle);
            AnimalUtility.DoSomething(chicken);


            Console.ReadLine();
        }