Incompatible type for argument 1 of 'setBounds'
- by Brandon
I am trying to do my own custom classes and learn C and Objective C. I'm recieving the error that there is an incompatible type for argument 1. I've defined a struct and class like this:
typedef enum {
kRedColor,
kGreenColor,
kBlueColor
} ShapeColor;
typedef struct {
int x, y, width, height;
} ShapeRect;
@interface Shape : NSObject
{
ShapeColor fillColor;
ShapeRect bounds;
}
- (void) setFillColor: (ShapeColor) fillColor;
- (void) setBounds: (ShapeRect) bounds;
- (void) draw;
@end // Shape
Then I import the Shape.h file(code above) and try and create a shape like this:
id shapes[4]; // I'm different!
ShapeRect rect0 = { 0, 0, 10, 30 };
shapes[0] = [Shape new];
[shapes[0] setBounds: rect0];
I get the error that setBounds is incompatible. For some reason it isn't looking at the Shape.h class for the setBounds method and it is instead looking at the default setBounds method? Is there something I'm doing wrong? Thanks!