method-parameters/by-value/class/date.cs - The class Date and the method DayDifference with a value parameter. | Lecture 5 - slide 22 : 29 Program 1 |
public class Date{ private int year, month, day; public Date(int year, int month, int day){ this.year = year; this.month = month; this.day = day; } public int Year{ get{return year;} set{year = value;} } public int Month{ get{return month;} set{month = value;} } public int Day{ get{return day;} set{day = value;} } public int DayDifference(Date other){ other.year++; return ...; } public override string ToString(){ return string.Format("{0}.{1}.{2}",day, month, year); } }