I have written two classes which contains same method (print). I want to access first class print method using second class object. How i can achieve this?
Code:
@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
Now i created second class object like
classB *B = [classB alloc]init];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…