init(stuNo: Int, department: Department) { self.stuNo = stuNo self.department = department super.init(firstName: "", lastName: "", age: 0, gender: Gender.unknow) } required convenience init() { self.init(stuNo: 0, department: .one) } //重写父类的计算属性 override var description: String { return "stuNo: \(self.stuNo), fullName: \(self.fullName), age: \(self.age), gender: \(self.gender), department: \(self.department)" } //重载父类run方法 override func run() { print("Student \(self.fullName) is running") } //遵循协议的方法 func lendBook() { print("Teacher \(self.fullName) lend a book") }}AppDelegate.swift://添加这一句:self.window?.rootViewController=UINavigationController(rootViewController:ViewController())运行结果: