• 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: Convenience Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convenience Methods


  • Subject: Re: Convenience Methods
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 25 Sep 2007 19:38:48 -0600


On Sep 25, 2007, at 7:31 PM, Tim Davis wrote:

1) I've added a convenience method to a class of mine so that it minimizes the init/retains needed to create one just to slap into an array. My question is, in the method should I be returning an object of type (id) or an object that is the type of the class I'm returning?

You should always return an object of type id, so that the class method will work correctly with subclasses of the object.


2) Using this method the object is autoreleased at some later point. If I add this to an array/dictionary etc....does the dictionary automaticly retain an instance or will it still disappear later?

Arrays, dictionaries, and sets all retain their objects when they are added.


Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Convenience Methods
      • From: Uli Kusterer <email@hidden>
References: 
 >Convenience Methods (From: Tim Davis <email@hidden>)

  • Prev by Date: Convenience Methods
  • Next by Date: NIB bug? Outlets = nil
  • Previous by thread: Convenience Methods
  • Next by thread: Re: Convenience Methods
  • Index(es):
    • Date
    • Thread