Multiple superclasses in Objective-C?

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

+5
source share
2 answers

As others have said, Objective-C is unidirectional. However, protocols provide convenient ways to get around any situation for which you may need multiple inheritance, and they avoid the errors that several inheritance creates, such as the Diamond Problem .

Edit: Changes the interface to the protocol. Sorry for confusing Java and Obj-C.

+7
source

No, Objective-C is just a single inheritance.

protocols, . , , .

+2

All Articles