私はObjective-Cの学習に没頭し、メソッドを呼び出すときに少し引っ掛かりました。これが私の簡単なコードスニペットです:
Player.h コード スニペット:
@interface Player : NSObject{
}
-(void) performAction;
-(int) addNumber:(int) a toNumber:(int) b;
@end
Player.m コード スニペット:
@implementation Player
-(void)performAction{
NSLog(@"Here it is!");
}
-(int)addNumber:(int)a toNumber:(int)b{
return a+b;
}
@end
main.m からメソッドを呼び出す:
int val = [playerOne addNumber:(int)3 toNumber:(int)3];
上記のコード行で、「Expected expression」エラーが発生し続けます。
何か案は ?