Last active
October 17, 2018 04:37
-
-
Save filipgorczynski/5e163943a2fc612bc3360fc99e1fe562 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 Celsius: | |
__multiplier = 1.8 | |
def __init__(self, temperature = 0): | |
self._temperature = temperature | |
def to_fahrenheit(self): | |
return (self._temperature * 1.8) + 32 | |
def get_temperature(self): | |
print("Getting value") | |
return self._temperature | |
def set_temperature(self, value): | |
print("Setting value") | |
return None | |
temperature = property(get_temperature,set_temperature) | |
t1 = Celsius(23) | |
print(t1.to_fahrenheit()) | |
t1.temperature = 45 | |
t1.__multiplier = 10 | |
print(t1.to_fahrenheit()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment