| method-parameters/by-value/struct/person.cs - The class Person which calls DayDifference on dateOfBirth. | Lecture 5 - slide 23 : 29 Program 2 |
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;
}
}