The C# ref parameter other in the method DayDifference will be an alternative name of the private instance variable dateOfBirth in an object of class Person. The year of this date of birth is incremented. This is the same effect as with the call-by-value parameter.
If the parameter other is a ref parameter it is important to notice what happens, if we assign to this parameter. We do not, however, in the concrete program. If we did, we could arrange that the private instance variable dateOfBirth in the Person object becomes a reference to a new Date.
Here is a tabular overview of the two exercises and the programs on the corresponding slides:
|