2016-07-22 258 views
-3

我從git倉庫克隆了一個iOS項目。該項目是用Objective-C編寫的。人<Person>,什麼是<Person>?

我看到這個代碼在頭文件:

@interface Employee: Person<Person> { 
    ... 
} 

是什麼Person <Person>意思?我知道它表示EmployeePerson的一個子類,但<Person>的特殊含義是什麼?

+0

閱讀本https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Protocols.html更多信息 –

回答

7

Employee是Person類的一個子類,它也符合名爲Person的協議。

@interface MySubclass : MySuperclass <MyProtocol> { ... } 
+0

啊哈,是的,協議!謝謝! –

+0

@ Leem.fin如果解決了您的疑問,您應該將答案標記爲正確。 –

+0

@VishalSonawane,是的,但你知道在答案被標記爲接受之前等待時間爲10分鐘。所以,我在等待:) –