views:

68

answers:

2

Can I inherit from multiple classes in Objective-C? (If yes, how so?)

+2  A: 

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.

quixoto
+4  A: 

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.

Shynthriir
Huh? "interface" is just the class declaration in Obj-C.
quixoto
Editing original posting. Got my terminology mixed up.
Shynthriir