• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: only defined for abstract class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: only defined for abstract class
      • From: Kay Roepke <email@hidden>
References: 
 >only defined for abstract class (From: Francis Derive <email@hidden>)
 >Re: only defined for abstract class (From: Pontus Ilbring <email@hidden>)
 >Re: only defined for abstract class (From: Francis Derive <email@hidden>)
 >Re: only defined for abstract class (From: "Mark Munz (DevList)" <email@hidden>)
 >Re: only defined for abstract class (From: Francis Derive <email@hidden>)

  • Prev by Date: Printing multiple pages from drawRect:
  • Next by Date: NSTextView and -smartInsertForString:replacingRange:beforeString:afterString:
  • Previous by thread: Re: only defined for abstract class
  • Next by thread: Re: only defined for abstract class
  • Index(es):
    • Date
    • Thread