classPerson {
funcrun(){
print("向前全速奔跑")
}
}
classTeacher:Person{
functeach() {
print("上课要迟到了")
super.run()
}
}
classStudent:Person{
varname =""{
willSet(new){
print("新值:\(new)")
}
didSet{
print("旧值:\(oldValue)")
}
}
overridefuncrun() {
print("体育课上跑了800米")
}
varheight:String{
return"175cm"
}
lazyvarage:String="18岁"
init(name:String,age:String) {
super.init()
self.name= name
self.age= age
}
publicfuncshow() {
print("名字:\(name),年龄:\(age),身高:\(height)")
}
deinit {
}
}