コード例 #1
0
 static void Main(string[] args)
 {
     Student student1 = new Student("Ivan", "Ivanov", "Ivanov", "Sofia", 123123123, 4, 123132, Specialty.Business, University.TU, Faculty.Management);
     Console.WriteLine(student1.ToString());
     Console.WriteLine();
     Student student2 = student1.Clone();
     Console.WriteLine(student2.ToString());
     if (student1.CompareTo(student2) == 0)
     {
         Console.WriteLine("student1 and student2 are identical copies");
     }
 }
コード例 #2
0
 public Student Clone()
 {
     Student clone = new Student
         (
         this.FirstName,
         this.MiddleName,
         this.LastName,
         this.Address,
         this.Phone,
         this.Course,
         this.SSN,
         this.Specialty,
         this.University,
         this.Faculty
         );
     return clone;
 }