• 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: Objective 2.0 properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective 2.0 properties


  • Subject: Re: Objective 2.0 properties
  • From: Charles Steinman <email@hidden>
  • Date: Thu, 16 Oct 2008 20:02:59 -0700 (PDT)

--- On Thu, 10/16/08, Ignacio Enriquez <email@hidden> wrote:

> @interface Lesson : NSObject {
> NSString *lessonTitle;
> NSDate *referDate;
> NSNumber *lessonDuration;
> }
> @property (nonatomic, retain) NSString* lessonTitle;
> @property (nonatomic, retain) NSDate *referDate;
> @property (assign) NSNumber * lessonDuration;

Why is lessonDuration assign? That's begging for a crash. All three of these should be copy since the classes all conform to NSCopying.

> So the question is
> Inside Lesson.m when i want to call or refer lessonTitle
> what is the best?
> self.lessonTitle or just only lessonTitle? (note that is
> nonatomic, retain))

I prefer to always use accessors. It simplifies memory management if nothing else.

> I have been trying a lot of conbination and none of them
> result in
> compilation errors, but when I run the application it
> crashes.!
> So I would like to know the difference between
> self.property and just property

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW17

Cheers,
Chuck

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________

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: Objective 2.0 properties
      • From: "Ignacio Enriquez" <email@hidden>
    • Re: Objective 2.0 properties
      • From: Nathan Day <email@hidden>
References: 
 >Objective 2.0 properties (From: "Ignacio Enriquez" <email@hidden>)

  • Prev by Date: Re: Hand-building an Application Menu
  • Next by Date: Re: Hand-building an Application Menu
  • Previous by thread: Objective 2.0 properties
  • Next by thread: Re: Objective 2.0 properties
  • Index(es):
    • Date
    • Thread