Protocols should work.
@protocol RobotProtocol <NSObject>
@required
- (void)doWork:(BOOL)flag;
@end
@interface Robot1 : NSObject <RobotProtocol>
@end
@implementation Robot1
- (void)doWork:(BOOL)flag
{
}
@end
Unit Test for Robot1
called though id<RobotProtocol>
- (void)testRobot
{
id<RobotProtocol> robot = [[Robot1 alloc] init];
[robot doWork:YES];
}
Update
After looking at your code, @interface Robot : NSObject
should be @interface Robot : NSObject <RobotProtocol>
. The thing is you don't need @interface Robot : NSObject <RobotProtocol>
at all. You can just use id<RobotProtocol>
. This is the name of your abstract class.