James Jagodzinski
James Jagodzinski

Reputation: 11

Extending a user defined class

I created a class called Box. I now understand that it is also a class defined in objective C. My Box class compiles without error and can be called by consumer classes. Now, I wish to extend the My box class. I get the error "Conflicting super class name 'Box'". Is there any way to tell XCode to extend the class I wrote?

Thanks,

James

Upvotes: 0

Views: 895

Answers (1)

pasawaya
pasawaya

Reputation: 11595

Forgive me if I'm misunderstanding your question, but you can try using categories. Categories are an alternative to subclassing, and allow you to add methods to a class.

This is how you would create a category for your Box class:

@interface Box (categoryName)
//New methods go here
@end

@implementation Box (categoryName)
//New methods implementation goes here
@end

Upvotes: 1

Related Questions