Swift中静态函数重载

2017-01-03  本文已影响0人  stonetingxin

```

import Foundation

classPerson:NSObject{

class func say(){

print("Person")

}

}

classTeacher :Person{

override class func say(){

print("Teacher")

}

}

classStudent :Person{

}

classProfessor :Teacher{

}

Teacher.say() //Teacher

Student.say() //Person

Professor.say() //Teacher

```

java的童鞋一定要注意啊。

上一篇下一篇

猜你喜欢

热点阅读