private static void TestSchool() { var math = new School.Discipline("Math"); Console.WriteLine("math.ToString(): " + math); var petrov = new School.Teacher("Petrov"); Console.WriteLine("Petrov.ToString(): " + petrov); petrov.AddDiscipline(math); // petrov.AddDiscipline(math); <-exeption petrov.RemoveDiscipline(math); petrov.AddDiscipline(math); var pesho = new School.Student("Pesho"); Console.WriteLine("Pesho.ToString(): " + pesho); var gosho = new School.Student("Gosho"); pesho.Comment = "Pesho hates math for no reason!"; Console.WriteLine("Pesho.Comment: " + pesho.Comment); var fiveB = new School.ClassOfStudents("FiveB"); Console.WriteLine("FiveB.ToString(): " + fiveB.ToString()); fiveB.AddStudent(pesho); fiveB.RemoveStudent(pesho); fiveB.AddStudent(pesho); fiveB.AddStudent(gosho); fiveB.AddTeacher(petrov); var sch = new School.School("2865th"); Console.WriteLine("Sch.ToString(): " + sch); sch.AddClass(fiveB); sch.Comment = "The school"; Console.WriteLine("Sch.Comment: " + sch.Comment); }
public void RemoveDiscipline(Discipline discipline) { this.disciplines.Remove(discipline); }
public void AddDiscipline(Discipline discipline) { this.disciplines.Add(discipline); }