objective-c Derived class may not respond to base class method
- by zadam
Hi,
I have derived from a 3rd party class, and when I attempt to call a method in the base class, I get the x may not respond to y compiler warning.
How can I remove the warning?
Repro:
@interface ThirdPartyBaseClass : NSObject {}
+(id)build;
-(void)doStuff;
@end
@implementation ThirdPartyBaseClass
+(id) build{
return [[[self alloc] init] autorelease];
}
-(void)doStuff{
}
@end
@interface MyDerivedClass : ThirdPartyBaseClass {}
+(id)buildMySelf;
@end
@implementation MyDerivedClass
+(id)buildMySelf{
self = [ThirdPartyBaseClass build];
[self doStuff]; // compiler warning here - 'MyDerivedClass' may not respond to '+doStuff'
return self;
}
@end
Thanks!