var att:Int=10{
//改变前调用willSet,参数为新值
willSet(newValue){
print(newValue)
print(att)
}
//改变后调用didSet,参数为旧值
didSet(oldValue){
print(oldValue)
print(att)
}
}
att=20;
var att:Int=10{
//改变前调用willSet,参数为新值
willSet(newValue){
print(newValue)
print(att)
}
//改变后调用didSet,参数为旧值
didSet(oldValue){
print(oldValue)
print(att)
}
}
att=20;