Multiple superclasses in Objective-C?
Can I inherit from multiple classes in Objective-C? (If ye开发者_运维百科s, how so?)
As others have said, Objective-C is single-inheritance. However, protocols provide handy ways to get around any type of situation you might have wanted multiple inheritance for and they allow you to avoid pitfalls that multiple inheritance creates such as The Diamond Problem.
Edit: Changes interface to protocol. Sorry, getting Java and Obj-C mixed up.
No, Objective-C is single-inheritance only.
Consider looking at protocols which are a way of exposing a declared interface from a class. It's not the same as multiple inheritance, but solves some needs.
精彩评论