Still new to Objective C, and I'm having some trouble that I just can't seem to figure out on my own. The error occurs twice for each of the first three @properties below, and is: error: "syntax error before ')' token".
#import <Foundation/Foundation.h>
@interface PolygonShape : NSObject {
int *numberOfSides;
int *minimumNumberOfSides;
int *maximumNumberOfSides;
}
@property (setter = setNumberOfSides) int *numberOfSides;
@property (setter = setMin) int *minimumNumberOfSides;
@property (setter = setMax) int *maximumNumberOfSides;
@property (readonly, getter = angleInDegrees) float *angleInDegrees;
@property (readonly, getter = angleInRadians) float *angleInRadians;
@property (readonly, getter = name) NSString *name;
- (id) init;
- (id) initWithSides: (int*) sides min: (int*) min max: (int*) max;
- (void) dealloc;
- (BOOL) setNumberOfSides: (int*) num;
- (void) setMin: (int*) num;
- (void) setMax: (int*) num;
- (void) description;
- (float*) angleInDegrees;
- (float*) angleInRadians;
- (NSString*) name;
@end
Not sure if this would make a difference, but here is a summarized version of the implementation:
#import "PolygonShape.h";
@implementation PolygonShape
@synthesize numberOfSides;
@synthesize minimumNumberOfSides;
@synthesize maximumNumberOfSides;
...
- (BOOL) setNumberOfSides: (int*) num {
if(num > minimumNumberOfSides && num < maximumNumberOfSides) {
[numberOfSides release];
numberOfSides = [num retain];
return YES;
} else {
NSLog(@"Number %i is out of range %i to %i", num, minimumNumberOfSides, maximumNumberOfSides);
return NO;
}
}
- (BOOL) setMin: (int*) num {
if(num > 2 && num <= maximumNumberOfSides) {
[minimumNumberOfSides release];
minimumNumberOfSides = [num retain];
return YES;
} elseif (num > 2 && maximumNumberOfSides == nil) {
[minimumNumberOfSides release];
[self setMax: 12];
minimumNumberOfSides = [num retain];
return YES;
} elseif (num > 2) {
NSLog(@"Polygons must have more than 2 sides.");
return NO;
} else {
NSLog(@"Please enter a number less than or equal to %i, the current maximum", maximumNumberOfSides);
return NO;
}
}
- (void) setMax: (int*) num {
if(num <= 12 && num < maximumNumberOfSides) {
[maximumNumberOfSides release];
maximumNumberOfSides = [num retain];
} elseif (num <= 12) {
NSLog(@"Please enter a number less than or equal to 12");
} else {
NSLog(@"Please enter a number greater than or equal to %i, the current minimum", minimumNumberOfSides);
}
}
...
@end
Thanks in advance for your help!