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