The following compiles with only a warning on Silver: “Method hides a method in parent class”
class Plant {
var height=0.0
var age=0
func getDetails()->String { return "Plant Details" }
}
class Tree:Plant {
private var limbs=0
func getDetails()->String { return "Tree Details" }
}
In Swift, compilation is supposed to fail and you are supposed to get error messages like the below:
main.swift:9:10: error: overriding declaration requires an 'override' keyword
func getDetails()->String { return "Tree Details" }
^
override
main.swift:4:10: note: overridden declaration is here
func getDetails()->String { return "Plant Details" }
^