My Class
@interface sample:NSObject{
double x;
double y;
}
@property double x;
@property double y;
-(sample *)initWithX: (double)x andY:(double) Y;
@implementation
@synthesize x,y
-(sample *) initWIthX: (double)x andY:(double)y{
self = [super init];
if(self)
{
self.x = x;
self.y = y;
}
return self;
}
-(BOOL)isEqual:(id)other{
if(other == self)
return YES;
if(!other || ![other isKindOfClass:[self class]])
return NO;
return [self isEqualToSample:other];
}
-(BOOL)isEqualToSample:(sample *) other{
if(self == other)
return YES;
if (!([self x] ==[other x]))
return NO;
if (!([self y] ==[other y]))
return NO;
return YES;
}
at
return [self isEqualToSample:other]; it shows warning: 'sample' maynot respont to '-isEqualToSample'. return makes integer from pointer without a cast.