Do I need variable and property at the same time?
I'm new in iOS development, and have trouble in understanding of some
cases. My question is do I need variable and property at the same time?
For example I saw code like this:
#import <Cocoa/Cocoa.h>
@interface Photo : NSObject {
NSString* caption;
NSString* photographer;
}
@property (retain) NSString* caption;
@property (retain) NSString* photographer;
@end
But, as I know, if I delete variables caption and photographer code still
will work:
#import <Cocoa/Cocoa.h>
@interface Photo : NSObject
@property (retain) NSString* caption;
@property (retain) NSString* photographer;
@end
So, please explain the difference of using first one and second.
Thanks, for any advices!
No comments:
Post a Comment