あなたはそれを完全に間違っています。人気のある構造は次のとおりです。
ClassB.h
@interface ClassB
- (void)method;
@end
ClassB.m
@interface ClassB()
@end
@implementation ClassB
- (void)method
{
//do nothing or even assert false
}
@end
ClassA.h
@interface ClassA : ClassB
@end
ClassA.m
@interface ClassA()
@end
@implementation ClassA
- (void)method
{
//do your stuff here
}
@end
そして、それはメソッドのオーバーライドと呼ばれます。しかし、私があなたが達成しようとしていることを正しく理解しているなら、あなたは持っているべきです:
ClassB.h
@interface ClassB
- (void)method;
@end
ClassB.m
@interface ClassB()
@end
@implementation ClassB
- (void)method
{
//do your stuff here
}
@end
ClassA.h
@interface ClassA : ClassB
@end
そして、ClassAを台無しにする必要はありません、そしてあなたは呼び出すことができます
ClassA *o=[[ClassA alloc ] init];
[o method];
次に、method
ClassBからの継承のおかげで、がclassAで使用可能になります。