import Foundation class Student{ func sayHi() { print("student say hi") } } extension Student{ func sayextensionFunc(){ print("extension func") } } class Persion:Student{ var _name:String init(name:String) { self._name = name } override func sayHi() { super.sayHi() print("say \(self._name)") } } var persion = Persion(name: "yihong") persion.sayHi() persion.sayextensionFunc()原文链接:https://www.f2er.com/swift/325912.html