Re: Objective 2.0 properties
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