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

Re: Newby Question


  • Subject: Re: Newby Question
  • From: Prachi Gauriar <email@hidden>
  • Date: Sat, 9 Jul 2005 23:55:16 -0400


On Jul 9, 2005, at 10:57 PM, Jerry Krinock wrote:

on 05/07/09 17:45, R T at email@hidden wrote:

I'm using an array in a class and I'm not sure how to
write the get and set methods...can anyone correct
these lines.

You may have read this article or one of its derivatives:

http://www.stepwise.com/Articles/Technical/2001-03-11.01.html

emphasizing the section "Always use Accessor Methods" (get and set).

But that section discusses accessing Objective-C *object* instance variables
(such as the NSNumber it uses as an example). Your instance variable is not
an object; it is a plain old C array. In my opinion, therefore, your code
is fine as far as it goes. It works, doesn't it?

No, it doesn't. It's a C array, which means it needs to be handled using a pointer and either memcpy(), memmove(), or a for loop.


-Prachi


_______________________________________________ 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
References: 
 >Re: Newby Question (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Complex document application
  • Next by Date: Re: Documentation frustrations
  • Previous by thread: Re: Newby Question
  • Next by thread: Re: Newby Question
  • Index(es):
    • Date
    • Thread