static void Main(string[] args) { Teacher classTeacher = new Teacher("Pesho"); Discipline discipline = new Discipline(); discipline.Name = "English"; discipline.NumberOfExercises = 15; discipline.NumberOfLectures = 30; classTeacher.AddDiscipline(discipline); List<Discipline> list = classTeacher.Disciplines; // add to this list does not change the internal list of disciplines list.Add(new Discipline { Name = "Biology", NumberOfLectures = 60, NumberOfExercises = 30 }); Student student1 = new Student(1,"Ani"); Student student2 = new Student(2, "Gosho"); Class mySchoolClass = new Class("a"); mySchoolClass.AddStudent(student1); mySchoolClass.AddStudent(student2); mySchoolClass.AddTeacher(classTeacher); School mySchool = new School(); mySchool.AddClass(mySchoolClass); mySchool.AddComment("My school"); Console.WriteLine(mySchool.Comment); }
static void Main(string[] args) { School school = new School("Telerik"); Class aClass = new Class("A"); Teacher teacherKiselov = new Teacher("Zdravko", "Kiselov"); teacherKiselov.Comment = "Na kosam"; Console.WriteLine(teacherKiselov.Comment); aClass.AddTeacher(teacherKiselov); aClass.AddStudent(new Student("Gosho","Georgiev",1)); aClass.AddStudent(new Student("Pencho", "Penchev", 2)); aClass.AddStudent(new Student("Ivan", "Ivanov", 3)); school.AddClass(aClass); foreach (var student in aClass.Students) { Console.WriteLine(student.Name); } }