Created
June 15, 2021 11:55
-
-
Save lgolubyev/1eacd1331b5e9fd2ee7893f9536a9ce1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Temperature | |
{ | |
public float Degrees { get; set; } | |
public Celsius ToCelsius() | |
{ | |
return new Celsius(((5.0f / 9.0f) * (this.Degrees - 32))); | |
} | |
public Fahrenheit ToFahrenheit() | |
{ | |
return new Fahrenheit(((9.0f / 5.0f) * this.Degrees + 32)); | |
} | |
} | |
Celsius cel = new Celsius(10); | |
Fahrenheit far = cel.ToFahrenheit(); | |
Celsius cel2 = far.ToCelsius(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment