struct Fash {
var temperature: Double
init() {
temperature = 32.0
}
}
var f = Fash()
print("默认构造器--\(f.temperature)")
struct Cele {
var temp: Double = 0.0
init(fromF f: Double) {
temp = (f - 32.0) / 1.8
}
init(fromK k: Double) {
temp = k - 222.1
}
}
let bol = Cele(fromF: 100)
let fre = Cele(fromK: 300)
print(bol , fre)
class Play {
var coinP: Int
init(coins: Int){
print("call")
coinP = coins
}
func win(coins: Int) {
coinP += 10
}
deinit {
coinP = 0
}
}
var playOne: Play?=Play(coins: 100)
print(playOne!.coinP)
playOne = nil