【发布时间】:2012-09-22 00:55:29
【问题描述】:
我只是 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
【问题讨论】:
-
你的问题太模糊了
-
Xcode 告诉我,第 2 行的不完整实现,这表明 @implementation 构造
-
在问题中包含这些重要信息。
-
哪个语句不需要分号?因为当我指示 _@implementation 或 _@interface ....时我没有使用。
-
我指的是
@implementation
标签: objective-c xcode cocoa-touch cocoa xcode4