Skip to content

Instantly share code, notes, and snippets.

@jebai0521
Created July 2, 2015 01:06
Show Gist options
  • Save jebai0521/4287567d3f567445b0db to your computer and use it in GitHub Desktop.
Save jebai0521/4287567d3f567445b0db to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface BarA : NSObject
//- (void) fun1;
//- (void) fun2;
@end
@implementation BarA
- (void) fun2
{
NSLog(@"parent fun2");
}
- (void) fun1
{
NSLog(@"aaa");
[self fun2];
}
@end
@interface BarB : BarA
@end
@implementation BarB
- (void) fun1
{
NSLog(@"bbb");
[self fun2];
}
- (void) fun2
{
NSLog(@"children fun2");
}
@end
int main(int argc, char *argv[]) {
@autoreleasepool {
BarA* a = [[BarB alloc] init];
[a fun1];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment