Back to notes -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    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);
  }

}
This example is about classes - not structs.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The object referred by other is mutated.
Do other things, and return some integer.