Re: only defined for abstract class
Re: only defined for abstract class
- Subject: Re: only defined for abstract class
- From: "Mark Munz (DevList)" <email@hidden>
- Date: Thu, 6 Oct 2005 13:18:24 -0500
On Oct 6, 2005, at 12:43 PM, Francis Derive wrote:
The concept article makes it clear that you can't call the
inherited object for primitive methods.
I has yet to be clear to me - but I am obliged to be conviced.
If you're doing the "true subclass", then you are providing the
storage mechanism for the object. To me, that says you need to fully
implement the primitives with your storage mechanism. In fact, one
way to implement it is given (that's to use the embedded
NSMutableArray).
By the way, if I understand well the third statement of a True
Subclass : "Override the superclass's primitive methods", where
does NSMutableArray overrides the NSArray's -count and -
objectAtIndex: ? Bizarre.
As I understand it, the primitives listed are specific to the class.
I assume you need to include both the NSArray and NSMutableArray (the
docs aren't clear on this point). It looks like the docs assume you
would only ever write to an NSMutableArray, but not read from it.
I think ALL the methods should be listed in the case of mutable
variants, since you'll likely need to access the class for reading as
well as writing.
You have to define that either as your own storage type, or the
other option is the composite example (where you wrap around the
NSMutableArray, in which case you have an embedded NSMutableArray).
I had done this way at first, but wanted to explore the
alternative of subclassing ...
In both cases, you're subclassing NSMutableArray. The wrapping option
differs only in that you're actually using another instance of
NSMutableArray to help implement your primitives. You're just using
another instance of NSMutableArray to do the storage work for you.
Mark Munz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden