static void Main(string[] args)
        {
            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 03, 17));
            Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 03));

            Console.WriteLine(peter);
            Console.WriteLine(stella);

            Console.WriteLine("{0} is older than {1} -> {2}",
                peter.FullName, stella.FullName, peter.CompareStudentsBirthDates(stella));

            Console.WriteLine("{0} is older than {1} -> {2}",
               stella.FullName,peter.FullName, stella.CompareStudentsBirthDates(peter));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Compare two students if this student is older
 /// return true, otherwise return false
 /// </summary>
 /// <param name="other"></param>
 /// <returns>boolean value</returns>
 public bool CompareStudentsBirthDates(Student other)
 {
     bool isStudentOlder = this.BirthDate.CompareTo(other.BirthDate) < 0;
     return isStudentOlder;
 }