A.h file
#import <Foundation/Foundation.h>
@interface A : NSObject{
int Stu_Age;
NSString *Stu_Name;
NSString *Stu_Address;
}
@property (nonatomic, assign) int Stu_Age;
@property (nonatomic,retain) NSString *Stu_Name;
@property (nonatomic, copy) NSString *Stu_Address;
@end
A.m file
#import "A.h"
@implementation A
@synthesize Stu_Age, Stu_Name, Stu_Address;
-(void)setStu_Age:(int)age{//assign pattern
Stu_Age = age;
}
-(void)setStu_Name:(NSString *)name{//retain pattern
if(nil != Stu_Name){
[Stu_Name release];
}
Stu_Name = [name retain];
}
-(void)setStu_Address:(NSString *)address{//copy pattern
if(nil != Stu_Address){
[Stu_Address release];
}
Stu_Address = [address copy];
}
@end