Possible Duplicate:
Objective-C multiple inheritance
I want to implement multiple inheritance in Objective-C i.e. I have a class "Sub" which needs to be a sublass of class "Super" as well as UITableViewController
How can I acheive the same in Obj-C?
Possible Duplicate:
Objective-C multiple inheritance
I want to implement multiple inheritance in Objective-C i.e. I have a class "Sub" which needs to be a sublass of class "Super" as well as UITableViewController
How can I acheive the same in Obj-C?
Objective-C doesn't support multiple inheritance. You could use a protocol, composition and message forwarding to achieve the same result.
A protocol defines a set of methods that an object must implement (it's possible to have optional methods too). Composition is basically the technique of include a reference to another object and calling that object when it's functionality is required. Message forwarding is a mechanism that allows objects to pass messages onto other objects, for example, an object that is included via composition.
Apple Reference:
There is no multiple inheritance in Objective-C. You can try to resolve what you need to with composition though.
Something like this:
@interface MyViewController : UIViewController {
Sub *mySubComponent;
}
@property (nonatomic, retain) Sub *mySubComponent;
// you can write wrapper methods here to call mySubComponent methods/messages