public static void TestOverriddenMethods() { Student firstStudent = new Student("Georgi", "Ivanov", "Mitkov", 1234, "bul.Bulgaria 20", "*****@*****.**", "0888123456", "IT", Specialties.SoftwareEngineering, Universities.Cambridge, Faculties.ITBackEnd); Student secondStudent = new Student("Kircho", "Mirkov", "Ivanov", 5678, "bul.Cherni Vruh 4", "*****@*****.**", "0885777666", "Maths", Specialties.Surgeries, Universities.KaspichanUniversity, Faculties.Medicine); var equalStudents = firstStudent == secondStudent; var hashCode = firstStudent.GetHashCode(); // Testing Equal() Console.WriteLine("\nFirst and second student are equal? -> {0}", equalStudents); GlobalConstants.ContentSeparator(); // Testing GetHashCode() Console.WriteLine("Hash code of first student -> " + hashCode); GlobalConstants.ContentSeparator(); // Printing Student Console.WriteLine(firstStudent); GlobalConstants.ContentSeparator(); // Changing the specialty on the cloning student doesnt affect the original firstStudent var firstStudentCloning = firstStudent.Clone() as Student; firstStudentCloning.Faculty = Faculties.Sports; Console.WriteLine(firstStudentCloning); // Comparing students by first criteria -> Names, then by second criteria -> SS Number GlobalConstants.ContentSeparator(); Console.WriteLine("Comparisson -> " + firstStudent.CompareTo(secondStudent) + Environment.NewLine); GlobalConstants.ContentSeparator(); }
// I thought it will look better to make a method printing both people here than in the main contructor // Dont judge by lazyness :D public static void PrintPeople(Person man, Person woman) { Console.WriteLine("Man and woman data"); GlobalConstants.ContentSeparator(); Console.WriteLine(man); GlobalConstants.ContentSeparator(); Console.WriteLine(woman); }