Class property observers override in Swift
Forums:
class Shape {
var lineCount = 0
}
class Square: Shape {
override var lineCount: Int {
willSet {
if newValue != 4 {
print("Square line count != 4 :)")
}
}
}
}
- Log in to post comments