Your answer got me thinking about Synthesized versus Explicit Instance
Variables.

I've been using Synthesized-Explicit Instance Variables.
That is, explicitly declaring iVars AND per ObjC_2, using
@property/@synthesize
directive to build the assessors.

Is there any benefit of using non-explicit/Synthesized Instance
Variables that you had mentioned?

Ric.

-----Original Message-----
From: mmalc crawford [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 08, 2008 11:56 AM
To: Lee, Frederick
Cc: cocoa-dev@lists.apple.com
Subject: Re: In dealloc(): ref @property, Can I use "<property object> =
nil; " vs "[<property object> release]; " ?


No.  I stated specifically "synthesized *instance variables*" and gave  
an example:

     @interface MyClass : NSObject
     {} // **** Note: no instance variables
     @property (retain) NSString *aString;
     @end

     @implementation MyClass
     @synthesize aString;
     -(void)dealloc {
           self.aString = nil;  // [aString release]; won't work
     }
     @end

If instead you had an explicit instance variable:

     @interface MyClass : NSObject {
          NSString *aString;
     }
     @property (retain) NSString *aString;
     @end

then you would use:

     @implementation MyClass
     @synthesize aString;
     -(void)dealloc {
         [aString release];
     }
     @end


mmalc


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to