Class property override in Swift
Forums:
class Shape {
var lineCount: Int {
return 0
}
}
class Square: Shape {
override var lineCount: Int {
return 4
}
}
let square = Square()
//square.lineCount is 4
- Log in to post comments