Can I inherit from multiple classes in Objective-C? (If yes, how so?)
+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
2010-10-07 20:41:27
Huh? "interface" is just the class declaration in Obj-C.
quixoto
2010-10-07 20:43:38
Editing original posting. Got my terminology mixed up.
Shynthriir
2010-10-07 20:46:49