I have experience with object-oriented programming however this situation is unfamiliar for some reason. Consider the following Objective-c 2.0 code:
@interface A : NSObject
@end
@implementation A
- (void) f {
[self g];
}
@end
@interface B : A
@end
@implementation B
- (void) g {
NSLog(@"called g...");
}
@end
Is this the correct way to call a method on a child class from a method in the parent class? What happens if another child class doesn't implement method g? Perhaps there's a better way to solve this like an abstract method in the parent class A?