• 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: Subclass of NSMutableArray isn't working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclass of NSMutableArray isn't working


  • Subject: Re: Subclass of NSMutableArray isn't working
  • From: Jamie Griffin <email@hidden>
  • Date: Wed, 10 Mar 2004 11:44:28 -0500

If the Graph class that you are making is intended to be used by other objects as an Array (in other words external objects are calling the count, addObject:, objectAtIndex:, etc methods directly) then maybe you really do want an NSMutableArray subclass.

I'm afraid that's exactly what I want. The outside world makes considerable use of NSMutableArray methods on Graph objects. I basically want a Graph to be an NSMutableArray with some additional methods (but no additional data), which seems like the perfect case for a subclass.

I have read up on class collections and have created my own data representation (an NSMutableArray inside) and overridden the primitive class and instance methods (I simply pass the buck for all, ex: -count has the implementation: return [internalArray count]). Now the class works as an NSMutableArray and responds to inherited methods but does not respond to my own instance methods. Any ideas?

I am open to the alternative of creating an NSObject subclass with an internal array. However, to do this I would need to find a way of passing messages to the array if my class does not respond to them (kind of like a subclass does naturally...). Would a delegate be appropriate?

-Jamie Griffin

"Darmok at Tenagra, Darmok and Gelad on the ocean."
<email@hidden><email@hidden>
_______________________________________________
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: Subclass of NSMutableArray isn't working
      • From: String <email@hidden>
    • Re: Subclass of NSMutableArray isn't working
      • From: Fritz Anderson <email@hidden>
    • Re: Subclass of NSMutableArray isn't working
      • From: Shawn Erickson <email@hidden>
References: 
 >Subclass of NSMutableArray isn't working (From: Jamie Griffin <email@hidden>)
 >Re: Subclass of NSMutableArray isn't working (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: Re: Wisdom of overriding isEqual:
  • Next by Date: [q] SMS / UPC (SMSC)
  • Previous by thread: Re: Subclass of NSMutableArray isn't working
  • Next by thread: Re: Subclass of NSMutableArray isn't working
  • Index(es):
    • Date
    • Thread