同じメソッド(print)を含む2つのクラスを作成しました。セカンドクラスのオブジェクトを使用してファーストクラスのprintメソッドにアクセスしたい。どうすればこれを達成できますか?
コード:
@interface classA : NSObject
-(void) print;
@end
@implementation classA
-(void) print
{
NSLog(@"hello");
}
@end
@interface classB : classA
-(void) print;
@end
@implementation classB
-(void) print{
NSLog(@"hey");
}
@end
今、私は次のような2番目のクラスのオブジェクトを作成しました
classB *B = [classB alloc]init];