I have the class Player
@interface Player : NSObject{...}
-(int) setAttack:(int)MonsterNumber;
Player.m
-(int) setAttack:(int)MonsterNumber{...
return damage;
}
However, when I run this program I get the error “Player.h:28:1: error: type of setter must be void [3]” I get this error 3 times.
Thank you for the help 🙂
The Cocoa pattern is that setters return (void) always. You really don’t want to do otherwise. Define a
damagegetter or @property. Or rename the method to something descriptive of what it does:I was surprised the compiler warned about it. I wasn’t able to reproduce the warning.