@interface A : NSObject
- (void) tmp;
- (void) foo;
@end
@implementation A
- (void) tmp {
[self foo];
}
- (void) foo {
NSLog(@"A");
}
@end
derived class
@interface B : A
- (void) foo;
@end
@implementation B
- (void) foo {
NSLog(@"B");
}
@end
code
B * b = [[B alloc] init];
[b tmp]; // -> writes out B
is there a way to implement A, so a call to [self foo] inside [self tmp] in class A would result in calling A:foo not B:foo
(so the output after calling [b foo] == @”B” and after calling [b tmp] == @”A”)
smth like
@implementation A
- (void) tmp {
[ALWAYS_CALL_ON_A foo];
}
You can use
super