예제 #1
0
 public void useIndexer()
 {
     Student2 student = new Student2();
     student[0] = "Programming";
     student[1] = "Ruby on Rails";
     Console.Out.WriteLine("second class: "+student[1]);
 }
예제 #2
0
 public void parameters()
 {
     Student2 student = new Student2();
     // call by value
     double simpleGrade = 3.2;
     student.modifyGrade(simpleGrade);
     Assert.assertThat("simpleGrade should still be the same", simpleGrade == 3.2);
     student.modifyGrade(ref simpleGrade);
     Assert.assertThat("simpleGrade has now changed",simpleGrade == 0.0);
     Grade grade = new Grade(1.3, "programming");
     DateTime dateTimeBefore = grade.Date;
     student.addGrade(grade);
     Assert.assertThat("the date in grade has changed", grade.Date != dateTimeBefore);
 }