Re: Newbie Question: implementing a stack
Re: Newbie Question: implementing a stack
- Subject: Re: Newbie Question: implementing a stack
- From: Graham Cox <email@hidden>
- Date: Sat, 20 Dec 2008 17:08:27 +1100
On 20 Dec 2008, at 4:52 pm, Graham Cox wrote:
On 20 Dec 2008, at 3:15 pm, Steve Wetzel wrote:
Regarding memory management - does it make more sense to copy the
object to be pushed from within the Stack object rather then
copying it externally before the push call? I am thinking that it
does because then that object is encapsulated which is how a stack
should really work. If I do this I realize I will need to
implement a copy method within any object that I want to place on
the stack if it does not already have one.
My own view is that the stack object shouldn't copy the object.
Of course, a very easy, and generally useful solution, is to provide
two methods:
- (void) push:(id) obj;
- (void) pushCopy:(id) obj;
G.
_______________________________________________
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