• 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: Extending NSMutableDictionary what am I doing wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extending NSMutableDictionary what am I doing wrong?


  • Subject: Re: Extending NSMutableDictionary what am I doing wrong?
  • From: Stefan Pantos <email@hidden>
  • Date: Fri, 27 Feb 2004 13:52:35 +0000

In the example the Louise C. Sacha give (extending from a NSObject) it is true you would have to write pass through methods but if you extend from the NSDictionary you only need to implement the primitive methods as all the other methods use them for there functionality(not including creation methods). This is because it is only the primitive method which access the instance variables.

Stefan

On 27 Feb 2004, at 13:29, Ben Dougall wrote:


On Friday, February 27, 2004, at 12:29 pm, Stefan Pantos wrote:

Hi,
As I under it you don't have to implement all the super classes methods only the primitive ones. Which in the case of NSDictionary are {- (unsigned)count; - (NSEnumerator *)keyEnumerator; - (id)objectForKey:(id)aKey;} And any creation methods which you want to be available. Is this correct?

So in the example for MonthArray at http://developer.apple.com/documentation/Cocoa/Conceptual/Foundation/ Concepts/ClassClusters.html#//apple_ref/doc/uid/20000262 you could call say initWithContentsOfFile: but it wouldn't necessarily work? There is no real way of know if a method is primitive or not till you try it unless they structure the interface is a way to make it > obvious?

also just to say that the primitive aspect you point out is i think irrelevant with the type of class cluster subclass that Louis C. Sacha was talking about and i was commenting on -- that is the example titled "A Composite Object: An Example" below that month array example on that page. that's irrelevant i think, because with that composite type you basically have a normal dictionary instance wrapped in your object (that also is a sublclass of the dictionary abstract class). and to enable access to the dictionary you have encased in your class you need to provide pass through methods regardless of primitive or non-primitive.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Extending NSMutableDictionary what am I doing wrong?
      • From: "Louis C. Sacha" <email@hidden>
References: 
 >Re: Extending NSMutableDictionary what am I doing wrong? (From: Ben Dougall <email@hidden>)

  • Prev by Date: Re: Extending NSMutableDictionary what am I doing wrong?
  • Next by Date: RE: Protocol doesn't seem to compile?
  • Previous by thread: Re: Extending NSMutableDictionary what am I doing wrong?
  • Next by thread: Re: Extending NSMutableDictionary what am I doing wrong?
  • Index(es):
    • Date
    • Thread