Created
February 24, 2016 08:07
-
-
Save MarcSteven/038c9807de653dd89929 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
import UIKit | |
class Oven { | |
var _temperature:Temperature = Temperature() | |
var temperature :Temperature { | |
get {return _temperature} | |
set { _temperature = newValue.copy() } | |
} | |
} | |
class House { | |
var thermostat :Temperature? | |
var oven : Temperature? | |
} | |
class Temperature { | |
var celsius:Double = 0 | |
var fahrenheit :Double { | |
get { return celsius * 9 / 5 + 30} | |
set {celsius = (newValue - 32)} | |
} | |
} | |
let home = House() | |
let temp = Temperature() | |
temp.fahrenheit = 75 | |
home.thermostat | |
let day :Double = 72 | |
print(day) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment