I have a class/super class pair declared thus:
@class WSStatement;
@interface WSIfStatement : WSStatement
@property (nonatomic, retain) WSStatement *thenstatement;
@end
I create an instance of the subclass using Core Data and assign it to a WSStatement * pointer (i.e. the super class). At some later point I want to send a message to the object that is specific to the subclass, and the compiler is giving me a warning saying “instance method not found (return type defaults to ‘id’)”
I have tried casting like this ….
[(WSIfStatement *)statement setThenStatement:aVariableParameter];
but the warning persists. The program executes perfectly, but I can’t rid myself of the pesky compiler warning. I couldn’t find a complete formal Objective-C syntax description anywhere, so I apologise if the answer is obvious!!
Thanks
If it is not a typo then the problem is you are calling the wrong method.
Also you can not just forward declare a class that you inherit from. You will need to include the header for
WSStatement. And if you still have an error make sure you synthesizethenstatementin the implementation.