Hello,
I've looked at this over and over again and I can't see the problem. Its probably obvious and I'm probably being an idiot and I apologize in advance for this.
In my interface I have:
@interface PolygonShape : NSObject { int numberOfSides; int minimumNumberOfSides; int maximumNumberOfSides; } @property int numberOfSides, minimumNumberOfSides, maximumNumberOfSides; // class methods + (float)getAngleInDegrees:(PolygonShape *) polyshape; + (float)getAngleInRadians:(PolygonShape *) polyshape; + (NSString)getName:(PolygonShape *) polyshape; //instance methods - (id)init; - (id)initWithNumberOfSides:(int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max; @end
The part in the implementation that I get errors is for the getName method:
@implentation... + (NSString)getName:(PolygonShape *) polyshape { // here is where I get the "error: can not use an object as parameter to a method" int sides = [polyshape numberOfSides]; NSString * s = [NSString init]; switch (sides) { case 3: s = "@Triangle"; // there's also an "assignment from incompatible pointer type" warning...but its secondary break; case 4: return "@Square"; break; default: break; } }
The thing that drives me batty is that the class methods works just fine: + (float)getAngleInDegrees:(PolygonShape *) polyshape; + (float)getAngleInRadians:(PolygonShape *) polyshape;
ube