我是 Objective-C 的新手,我还没有进入 cocoa touch 库,但我正在尝试遵循 Objective-C 的书并编写一些课程以进行更多的练习。
我在实施声明中有一个错误,你能告诉我我犯了哪部分错误吗?
#import "getterSetter.h"
@implementation getterSetter
@synthesize airportName;
- (char) print : (char) name
{
return name;
}
- (int) zip : (int) zipair
{
return zipair;
}
@end
int main(int argc,char *argv[])
{
char *airportName;
getterSetter *airport = [[getterSetter alloc]init];
NSLog(@"Please enter the airport name:\n");
scanf("%c",&airportName);
NSLog(@"Please enter the airport name:\n");
scanf("%c",&airportName);
NSLog(@"Your Airport Name is :\n");
[airport print:*airportName];
}
#import <Foundation/Foundation.h>
@interface getterSetter : NSObject
{
char *airportName;
int zipCode;
char *airportCityName;
}
- (char) print : (char) name;
- (int) zip;
@property char *airportName;
@end