コード例 #1
0
        static void Main()
        {
            /*定义教师、本科生、研究生、交换生;*/
            Faculty msYang = new Faculty("2002010", "杨雪梅", Gender.FEMALE, "人文与管理学院")
            {
                BirthDate  = new DateTime(1975, 12, 1),
                Speciality = "数据仓库与数据挖掘、医学统计"
            };
            Undergraduate boy = new Undergraduate("3210707000", "张三", Gender.MALE, "21信管")
            {
                BirthDate   = new DateTime(2003, 1, 2),
                PhoneNumber = "18900001111",
            };
            Postgraduate girl = new Postgraduate("2190757001", "李四", Gender.FEMALE, msYang);

            girl.AssignDirection("数据可视化");
            ExchangeStudent newGuy = new ExchangeStudent("20200531001", "王五", Gender.MALE, "20信管", "江西中医药大学")
            {
                Instructor = msYang
            };

            /*显示;介绍所有用户;批量注册;*/
            UserUi.Display(boy);
            StudentUi.Display(boy);
            UndergraduateUi.Display(newGuy);
            UserService.IntroduceAll(new User[] { msYang, boy, girl, newGuy });
            WriteLine();
            StudentService.RegisterAll(boy, girl, newGuy);
            Read();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: SmartLinli/LearningCSharp
        static void Main()
        {
            Undergraduate   boy    = new Undergraduate("3210707000", "张三", Gender.MALE, "21信管");
            ExchangeStudent newGuy = new ExchangeStudent("20200531001", "王五", Gender.MALE, "20信管", "江西中医药大学");

            boy.TransferToMajor("21康复");
            newGuy.TransferToMajor("20健管");
            Read();
        }
コード例 #3
0
 /// <summary>
 /// 显示本科生;
 /// </summary>
 /// <param name="undergraduate">本科生</param>
 public static void Display(Undergraduate undergraduate)
 {
     WriteLine
         ($"本科生信息:\n学号:{undergraduate.Number,-15}姓名:{undergraduate.Name}\n" +
         $"性别:{undergraduate.Gender,-14}生日:{undergraduate.BirthDate:D}\n" +
         $"手机号:{undergraduate.PhoneNumber}\n" +
         $"班级:{undergraduate.Class,-13}本科生导师:{undergraduate.Instructor.Name}");
     undergraduate.Intro();
     WriteLine("\n");
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: SmartLinli/LearningCSharp
        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();
        }
コード例 #5
0
        static void Main()
        {
            Undergraduate
                boy = new Undergraduate("3180707001", "张三")
            , girl  = new Undergraduate("3180707002", "李四");

            boy.InstructorService  = new AssignInstructorByRandom();              //将实现了指定接口的不同对象赋予(注入)该属性,从而实现不同的行为;
            girl.InstructorService = new AssignInstructorBySelection();

            boy.AssignInstructor();
            girl.AssignInstructor();
            Read();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: SmartLinli/LearningCSharp
        static void Main()
        {
            Faculty msYang = new Faculty("2002010", "杨雪梅", Gender.FEMALE, "人文与管理学院")
            {
                PhoneNumber = "13322223333"
            };
            Undergraduate boy = new Undergraduate("3210707000", "张三", Gender.MALE, "21信管")
            {
                PhoneNumber = "15955559999"
            };

            msYang.SendSms("请抓紧登分。");
            boy.SendSms("请抓紧评教。");
            Read();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: SmartLinli/LearningCSharp
        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();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: SmartLinli/LearningCSharp
        static void Main()
        {
            Faculty       msYang = new Faculty("2002010", "杨雪梅", Gender.FEMALE, "人文与管理学院");
            Undergraduate boy    = new Undergraduate("3210707000", "张三", Gender.MALE, "21信管");
            Postgraduate  girl   = new Postgraduate("2190757001", "李四", Gender.FEMALE, msYang);

            girl.AssignDirection("数据可视化");
            ExchangeStudent newGuy = new ExchangeStudent("20200531001", "王五", Gender.MALE, "20信管", "江西中医药大学");

            boy.Intro();
            WriteLine();
            girl.Intro();
            WriteLine();
            newGuy.Intro();
            Read();
        }