Re: Sub classing.
Re: Sub classing.
- Subject: Re: Sub classing.
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 5 Dec 2006 07:59:05 -0800
On Dec 5, 2006, at 7:36 AM, James Bucanek wrote:
The other way of doing this is to create a catagory. You can use
this to tack your methods onto the implementation of NSMutableArray:
@interface NSMutableArray (StatusTableDataset) {
- (id)getStatusObjectAtIndex:(unsigned int)index;
...
Once you do that, you can send any instance of NSMutableArray the
message getStatusObject:. The only limitation of catagories is that
you can't add instance variables to the class, only methods.
James' suggestion of subclassing NSObject and wrapping an instance of
NSMutableArray is dead on.
The above works, but please don't use this pattern. It'll make a
downright mess out of your code. It adds functionality to all mutable
arrays across your program and not just the ones you are using to
store the StatusTable stuff. This makes the code less reusable and
harder to debug.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden