Exemple #1
0
        static void Main(string[] args)
        {
            //One one = new One();
            Dog dog = new Dog();

            dog.Age = 10;
            dog.Bite();
            dog.GetAge();
            dog.BiteMan();
            //构造实例化: 先调用父类构造函数,在调用子类的构造函数

            Dog dog2 = new Dog(10);
            //默认先调用父类的默认构造函数, 在调用子类的特定构造函数

            Animal dog3 = new Dog();

            dog3.Bite();           //调用子类

            dog3.BiteMan();        //调用父类
            ((Dog)dog3).BiteMan(); //调用父类

            Console.ReadLine();
        }