Re: Convenience Methods
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