saidozcan
saidozcan

Reputation: 2215

Objective C: Extend From Different Classes

I want to extend my ViewController from MKNetworkEngine class but I have already extended it from UIViewController class. How can I extend them both? Here's my code:

#import <UIKit/UIKit.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import "MKNetworkKit.h"

@interface ViewController : MKNetworkEngine UIViewController<UITableViewDataSource,UITableViewDelegate,UINavigationControllerDelegate>

Thanks for your help.

Upvotes: 0

Views: 96

Answers (1)

Abizern
Abizern

Reputation: 150615

You can't. Multiple inheritance is not supported in Objective-C. Composition is preferred over inheritance.

What you can do is have a reference to an object of a different class in you object and make calls to that.

Upvotes: 2

Related Questions