Objective-c プログラミングを学習していますが、解決できないエラーが 2 つあります。何が悪いのか教えていただけますか?
#import "Fraction.h"
int main (int argc, char * argv[]) {
@autoreleasepool {
Fraction *aFraction = [[Fraction alloc] init];
Fraction *bFraction = [[Fraction alloc] init];
[aFraction setTo: 1 over: 4];
[bFraction setTo: 1 over: 2];
[aFraction print];
NSLog (@"+");
[bFraction print];
NSLog (@"=");
[aFraction add: bFraction]; /*error 1: No visible @interface for 'Fraction' declares the selector 'add:'*/
[aFraction reduce];
[aFraction print]; }
return 0; }
#import <Foundation/Foundation.h>
@interface Fraction : NSObject
@property int numerator, denominator;
-(void) print;
-(void) setTo: (int) n over: (int) d;
-(double) convertToNum;
-(void) add: (Fraction *) f;
-(void) reduce; /*error 2: Expected identifier or '(' */
@end