親クラスに書いておくだけで
[HogeHoge hogeWithDictionary];
[Poi hogeWithDictionary];
によって子のオブジェクトが作れます。
hoge.m
@interface Hoge : NSObject
+ (id)hogeWithDictionary:(NSDictionary *)dic;
@end
@interface HogeHoge : Hoge
@end
@interface Poi : Hoge
@end
@implementation Hoge
+ (id)hogeWithDictionary:(NSDictionary *)dic
{
Hoge *hoge = [[[[self class] alloc] init] autorelease];
[hoge setUp:dic];
return hoge;
}
- (void)setUp:(NSDictionary *)dic
{
//処理
NSLog(@"Hoge処理");
}
@end
@implementation HogeHoge
- (void)setUp:(NSDictionary *)dic
{
[super setUp:dic];
//処理
NSLog(@"HogeHoge処理");
}
@end
@implementation Poi
- (void)setUp:(NSDictionary *)dic
{
//処理
NSLog(@"Poi処理");
}
@end