public class Test
public Shared Sub Main
Dim sngFahrenheit As Single
Dim sngCelsius As Single
sngCelsius = 12.12
sngFahrenheit = DegreesByValue(sngCelsius)
Console.WriteLine(sngCelsius.ToString & " degrees Celsius are " & _
sngFahrenheit.ToString & " degrees Fahrenheit.")
sngCelsius = 12.12
sngFahrenheit = DegreesByReference(sngCelsius)
Console.WriteLine(sngCelsius.ToString & " degrees Celsius are " & _
sngFahrenheit.ToString & " degrees Fahrenheit.")
End Sub
Shared Function DegreesByValue(ByVal sngCelsius As Single) As Single
DegreesByValue = (9 / 5) * sngCelsius + 32
sngCelsius = 0
End Function
Shared Function DegreesByReference(ByRef sngCelsius As Single) As Single
DegreesByReference = (9 / 5) * sngCelsius + 32
sngCelsius = 0
End Function
End class
|