What is the best way to declare a property?
- by Simon
Hi. We declare properties using the @property keyword and synthesize it in the implementation file. My question is,
What if I declare a property using the @property keyword and also declare a variable in the interface block with the same name? For example, consider the following code,
Interface:
@interface myClass : NSObject {
NSString *myClass_name; // LINE 1
}
@property(nonatomic, retain) NSString *myClass_name; // LINE 2
@end
Implementation:
@implementation myClass
@synthesize myClass_name // LINE 3
@end
Declaring myClass_name in LINE 1 will make any problem? Like any reference problem or any unnecessary memory consumption problem?