Open baya opened 10 years ago
http://cocoadevcentral.com/d/learn_objectivec/ http://rypress.com/tutorials/objective-c/classes.html
类的实现分 Interface 和 Implementation 两个部分
#import <Cocoa/Cocoa.h> @interface Photo : NSObject { NSString* caption; NSString* photographer; } - caption; - photographer; @end
NSObject是Photo的父类 表示实例方法 表示类方法 Implementation
NSObject是Photo的父类
#import "Photo.h" @implementation Photo - (NSString*) caption { return caption; } - (NSString*) photographer { return photographer; } @end
相关链接
http://cocoadevcentral.com/d/learn_objectivec/ http://rypress.com/tutorials/objective-c/classes.html
速读
类的实现分 Interface 和 Implementation 两个部分
Interface
Init
Dealloc