Objective-Cは丸投げ処理を比較的簡単に書けます。
こんな感じで
- (id)forwardingTargetForSelector:(SEL)aSelector
{
if ([subcontractor respondsToSelector:aSelector]) {
return subcontractor;
} else {
return [super forwardingTargetForSelector:aSelector];
}
}
丸投げするメソッドをまとめたカテゴリーを定義しておかないとエラーになるので実装の手間が省けるぐらいかもしれませんですが。。。