示例#1
0
        static void Main(string[] args)
        {
            Student student = new Student(new Person("Keith", "Ebner", DateTime.Parse("1978-05-11")), Person.Education.Specialist, 4);
            Console.WriteLine(student.ToShortString());
            Console.WriteLine();
            Console.WriteLine("SecondEducation" + student[Person.Education.SecondEducation]);
            Console.WriteLine("Specialist" + student[Person.Education.Specialist]);
            Console.WriteLine("Вachelor" + student[Person.Education.Вachelor]);
            Console.WriteLine();
            Console.WriteLine(student.ToString());
            student.AddExams(new Person.Exam("Math", 4, DateTime.Parse("2013-12-12")), new Person.Exam("History", 5, DateTime.Parse("2013-11-12")));
            Console.WriteLine();
            Console.WriteLine(student.ToString());

            Student student1 = (Student)student.DeepCopy();
            student1.Person.DOB = DateTime.Parse("1985-05-11");

            Console.WriteLine();
            Console.WriteLine(student.ToString());

            Console.WriteLine();
            Console.WriteLine(student1.ToString());

            Console.ReadLine();

            Test();
        }
示例#2
0
 public object DeepCopy()
 {
     Student student = new Student();
     student._person = (Person)this._person.DeepCopy();
     student._education = this._education;
     foreach (Person.Exam item in _exams)
     {
         student._exams.Add((Person.Exam)item.DeepCopy());
     }
     student._groupNumber = this._groupNumber;
     return student;
 }