Skip to content

Instantly share code, notes, and snippets.

@MarcSteven
Created February 24, 2016 08:07
Show Gist options
  • Save MarcSteven/038c9807de653dd89929 to your computer and use it in GitHub Desktop.
Save MarcSteven/038c9807de653dd89929 to your computer and use it in GitHub Desktop.
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