• 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: Jerry Krinock <email@hidden>
  • Date: Sat, 09 Jul 2005 19:57:31 -0700

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?

You should be aware, though, that you rarely see plain old C arrays in
Objective-C code.  We instead use NSArray or NSMutableArray, because they
are, to put it mildly, way more flexible.


 _______________________________________________
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

  • Follow-Ups:
    • Re: Newby Question
      • From: Prachi Gauriar <email@hidden>
    • Re: Newby Question
      • From: Andy Lee <email@hidden>
References: 
 >Newby Question (From: R T <email@hidden>)

  • Prev by Date: Concerning Custom Sheets and NIB files...
  • Next by Date: Re: Documentation frustrations
  • Previous by thread: Newby Question
  • Next by thread: Re: Newby Question
  • Index(es):
    • Date
    • Thread