• 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: Newbie Question on "self"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Question on "self"


  • Subject: Re: Newbie Question on "self"
  • From: Charles Steinman <email@hidden>
  • Date: Mon, 11 Aug 2008 11:25:15 -0700 (PDT)

--- On Mon, 8/11/08, Todd Heberlein <email@hidden> wrote:

> Well, you don't need the "self" prefix, but
> you may want to look at
> using "setters" and "getters". It would
> look like this
>
> @interface MyThingy : NSObject {
> 	...
> 	NSString*	myString;
> 	...
> };
> ...
> @property (copy) NSString* myString;
> ...
> @end
>
>
>
> And then in the implementation file you would have
> something like this:
>
> @implementation MyThingy
> ...
> @synthesize myString;
> ...
> @end
>
>
> And then, when you set the value, you do it like this:
>
> [self setMyString: anotherString];

Using dot-syntax calls getters and setters. You would get exactly the same behavior by calling self.myString = anotherString.

Cheers,
Chuck



_______________________________________________

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

  • Follow-Ups:
    • Re: Newbie Question on "self"
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Newbie Question on "self" (From: Todd Heberlein <email@hidden>)

  • Prev by Date: Re: Newbie Question on "self"
  • Next by Date: Opening an external file in a external application
  • Previous by thread: Re: Newbie Question on "self"
  • Next by thread: Re: Newbie Question on "self"
  • Index(es):
    • Date
    • Thread