3
我想重寫屬性觀察器並調用「super.didSet」。那可能嗎?覆蓋didSet
class Foo {
var name: String = "" { didSet { print("name has been set") } }
}
class Bar: Foo {
override var name: String = "" {
didSet {
print("print this first")
// print the line set in the superclass
}
}
}
什麼你想從這些印刷(...)■看到輸出? – Ismail