@interface MyClass : NSObject {
int memberVar1; // 实体变量
id memberVar2;
}
+ (return_type)class_method; // 类方法
- (return_type)instance_method1; // 实例方法
- (return_type)instance_method2:(int)p1;
- (return_type)instance_method3:(int)p1 andPar:(int)p2;
@end
|
|
V
@implementation MyClass {
int memberVar3; // 私有实体变量
}
- (return_type)instance_method1 {
....
}
- (return_type)instance_method2:(int)p1 {
....
}
- (return_type)instance_method3:(int)p1 andPar:(int)p2 {
....
}
@end
#import <文件目录/文件名>
Car *car = [Car new];
[类 方法:@"标题" : @"目录"];
[car go:@"车类" : @"开车"];