public class Person{
private string name;
private Date dateOfBirth;
private Date? dateOfDeath;
public Person (string name, Date dateOfBirth){
this.name = name;
this.dateOfBirth = dateOfBirth;
this.dateOfDeath = null;
}
public string Name{
get {return name;}
}
public Date DateOfBirth{
get {return dateOfBirth;}
}
public int DayAge(){
return new Date(2007, 9, 25).DayDifference(dateOfBirth);
}
public override string ToString(){
return "Person: " + name + " " + dateOfBirth;
}
} | |
A copy of dateOfBirth is passed.
This is because Date is a struct, not a class.
|