Exemplo n.º 1
0
        static void Main()
        {
            Undergraduate   boy    = new Undergraduate("3210707000", "张三", Gender.MALE, "21信管");
            Postgraduate    girl   = new Postgraduate("2190757001", "李四", Gender.FEMALE, "杨雪梅");
            ExchangeStudent newGuy = new ExchangeStudent("20200531001", "王五", Gender.MALE, "20信管", "江西中医药大学");

            boy.Register();
            girl.Register();
            newGuy.Register();
            Read();
        }
Exemplo n.º 2
0
        static void Main()
        {
            Undergraduate boy = new Undergraduate("3210707000", "张三", Gender.MALE)
            {
                Class      = "21信管",
                Instructor = "林立"                                                                                     //派生类访问自身的属性;
            };
            Postgraduate girl = new Postgraduate("2190757001", "李四", Gender.FEMALE);

            boy.Intro();                                                                            //派生类调用顶层基类的方法;
            girl.Intro();
            boy.Register();                                                                         //派生类调用基类的方法;
            girl.Register();
            girl.AssignDirection("数据可视化");                                                          //派生类调用自身的方法;
            Read();
        }