Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective 2.0 properties



--- 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Objective 2.0 properties (From: "Ignacio Enriquez" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.