Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    A client of the Person which modifies the returned birth Date.Lecture 4 - slide 29 : 29
Program 3
using System;

class Client{

  public static void Main(){

    Person p = new Person("Hanne", new Date(1926, 12, 24));  

    Date d = p.GetDateOfBirth();               
    d.SetYear((ushort)(d.GetYear() - 100));    
    Console.WriteLine("{0}", p);

    Date today = new Date(2006,9,27);
    Console.WriteLine("Age of Hanne as of {0}: {1}.", 
                      today, p.AgeAsOf(today));   
  }

}
 
 
 
 
 
 
Hanne is born December 24, 1926.
 
Leak of Hanne's birthday...
followed by a mutation of the leaked Date.
 
 
 
 
This makes Hanne far too old.