コード例 #1
0
        // Start method
        private static void Main(string[] args)
        {
            var mathsA = new SubjectMark(10);
            var ageA = 10;

            var mathsB = new SubjectMark(10);
            var ageB = 10;

            var studentA = new StudentRegistry();
            studentA.Update(ageA, mathsA);

            var studentB = new StudentRegistry();
            studentB.UpdateRef(ref ageB,ref mathsB);

            Console.WriteLine("Student A >> " + studentA.StudentAge + "vs. " + ageA + ", " + studentA.SubMark.Mark + "vs." + mathsA.Mark);
            Console.WriteLine("Student B >> " + studentB.StudentAge + "vs. " + ageB + ", " + studentB.SubMark.Mark + "vs." + mathsB.Mark);

            Console.ReadKey();
        }
コード例 #2
0
 public void UpdateRef(ref int studentAge,ref SubjectMark subjectMark)
 {
     StudentAge = studentAge;
     subjectMark.Mark++;
     SubMark = subjectMark;
 }
コード例 #3
0
 public void Update(int studentAge, SubjectMark subjectMark)
 {
     StudentAge = studentAge + 1;
     subjectMark.Mark++;
     SubMark = subjectMark;
 }