示例#1
0
        public static void Main(string[] args)
        {
            Animal animal = new Animal();

            animal.Greet();
            Dog dog = new Dog();

            dog.Greet();
        }
示例#2
0
        static void Main(string[] args)
        {
            Animal animal = new Animal();

            animal.Greet();
            Dog dog = new Dog();

            dog.Greet();

            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            Animal a1 = new Animal();

            a1.Talk();
            a1.Sing();
            a1.Greet();
            Animal a2 = new Dog(); // Object of type Animal which references to object of type Dog

            a2.Talk();
            a2.Sing();
            a2.Greet();
            Console.ReadLine();
        }