貌似 Swift 完美貫徹了 Liskov Substitution Principle,像蘋果 UIKit 裏面 UITableView 繼承自 UIScrollView,然後 override 掉了 UIScrollView 的 delegate property 所 conformed to 的 protocol 的這種做法在 Swift 裏面就不行了。但是我上維基看了下 Liskov Substitution Principle 的定義,感覺以上這種做法並不違反 Liskov Sbustituion Principle 啊。
Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S, where S is a subtype of T.
但是 UITableViewDelegate protocol 繼承自 UIScrollViewDelegate protocol 啊。
Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S, where S is a subtype of T.
但是 UITableViewDelegate protocol 繼承自 UIScrollViewDelegate protocol 啊。