objective-c Derived class may not respond to base class method
Posted
by zadam
on Stack Overflow
See other posts from Stack Overflow
or by zadam
Published on 2010-03-10T01:47:11Z
Indexed on
2010/04/25
4:43 UTC
Read the original article
Hit count: 407
objective-c
|compiler-warnings
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!
© Stack Overflow or respective owner