chuck
chuck

Reputation: 31

How to put more than one subclass in objective c

How can I do something like this ?

@interface SomeClass:NSViewController **:NSTableViewController** @end 

How can i put two subclases in my class ??

Upvotes: 1

Views: 168

Answers (1)

justin
justin

Reputation: 104698

Objective-C does not support Multiple Inheritance.

Typically, you work around this by using protocols when you want to program to an interface.

@interface SomeClass : NSViewController < SomeProtocol >
@end 

Another option is composition:

@interface SomeClass : NSObject
{
@private
  NSViewController * viewController;
  NSTableViewController * tableViewController;
}
@end 

Upvotes: 7

Related Questions