Back to notes -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    The struct Date and the method DayDifference with a value parameter.Lecture 5 - slide 23 : 29
Program 1
public struct 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);
  }

}
A struct - not a class.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
A COPY of the actual parameter is mutated.
Return the appropriate integer result.