摘要: 1.例子:AddressCard.h接口文件#import<Foundation/Foundation.h>@interface AddressCard:NSObject<NSCoding,NSCoping>@property (copy,nonatomic) NSString *name,email;-(void)setName:(NSString) *theName andEmail:(NSString *)theEmail;-(NSComparisonResult) compareNames:(id)element;-(void)print;AddressCard 阅读全文
posted @ 2013-01-31 16:36 gagag 阅读(3254) 评论(0) 推荐(0) 编辑
摘要: @interface Fraction:NSObject<NSCopying>-(id)copyWithZone:(NSZone*)zone{ Fraction *newFract = [[Fraction allocWithZone:zone]init];//如果Fraction类有子类, //应改为 id newFract = [[self class] allocWithZone:zone] init];// [newFract setTo:numerator over:denominator]; return newFract;} 阅读全文
posted @ 2013-01-31 13:25 gagag 阅读(1354) 评论(0) 推荐(0) 编辑