当前位置: 首页>>代码示例>>C#>>正文


C# Class.AddATeacher方法代码示例

本文整理汇总了C#中Class.AddATeacher方法的典型用法代码示例。如果您正苦于以下问题:C# Class.AddATeacher方法的具体用法?C# Class.AddATeacher怎么用?C# Class.AddATeacher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Class的用法示例。


在下文中一共展示了Class.AddATeacher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            //Instance of a school
            School mySchool = new School("125SOU");
            //Instance of a new teacher
            Teacher teach01 = new Teacher("Antonova");
            //Instance of a new discipline
            Discipline discipl01 = new Discipline(DisciplineName.Arts);
            //Add a discipline to teachers list - during this process you have to mark number of lectures and number of exercises
            teach01.AddDiscipline(discipl01);
            //instance of a new class
            Class myClass = new Class("first B");
            //Add this class to schools list
            mySchool.AddAClassInTheSchool(myClass);

            //Instance of another class - with the same name(identifier) - to check if it unique
            Class anotherClass = new Class("first B");
            //Add another class with the same identifier - the program will warn you and will ask to change this identifier
            mySchool.AddAClassInTheSchool(anotherClass);

            //Instance of a student
            Student stud01 = new Student("Petar");
            //Add this student to first class
            myClass.AddAStudent(stud01); //The program will ask for classnumber and will check if it unique

            //Instance of another student
            Student stud02 = new Student("Vania");
            myClass.AddAStudent(stud02); //Try to give this student the same class number as the first student

            //Add a teacher to a class
            myClass.AddATeacher(teach01);

            //Test adding comments
            mySchool.AddComment();
            teach01.AddComment();
        }
开发者ID:Bonevm01,项目名称:OOP_Principles1,代码行数:36,代码来源:SchoolTest.cs


注:本文中的Class.AddATeacher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。