ios - Property Setter and Getter Not able to overwrite -
this question has answer here:
so have objective-c header file animal class:
#import <foundation/foundation.h> @interface animal : nsobject @property nsstring *name; @property nsstring *favoritefood; @property nsstring *sound; @property float weight; -(instancetype) initwithname:(nsstring *) defaultname; -(void) getinfo; -(float) getweightinkg: (float) weightinlbs; -(nsstring *) talktome: (nsstring *) myname; -(int) getsum: (int) num1 nextnumber: (int) num2; @end
and reason when try overwrite setter or getter methods @property nsstring *name in implementation file of animal class, not able , gives me warning saying "writable atomic property 'name' cannot pair synthesized getter user defined setter". doing wrong here? because thought @property creates ivar , setter , getter methods automatically can override in implementation file. can please me issue. thank in advance!
define properties as:
@property (nonatomic) nsstring *name; @property (nonatomic) nsstring *favoritefood; @property (nonatomic) nsstring *sound;
Comments
Post a Comment