Re: Do I need private accessor methods?
Re: Do I need private accessor methods?
- Subject: Re: Do I need private accessor methods?
- From: Ryan Britton <email@hidden>
- Date: Fri, 28 Apr 2006 15:15:18 -0700
They are very useful for ensuring your code is threadsafe. For this
reason alone I recommend using them. Take a look at the following
link to solve your last concern:
http://www.kevincallahan.org/software/accessorizer.html
On Apr 28, 2006, at 2:32 PM, Eric Lin wrote:
Do I need to create private accessor methods for my private instance
variables? I'm asking this because the most correct constructure
form seems
to require it:
if (self = [super init]) {
[self setPrivateVariable:123];
}
This wouldn't be correct in the case that [super init] returns a
different
self:
if (self = [super init]) {
privateVariable = 123;
}
If I indeed have to do it the first way, how do I create private
accessor
methods? And should I make it a rule of thumb to create accessor
methods
for all private variables? (would seem like quite a chore though).
Thanks,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden