Skip to content

Instantly share code, notes, and snippets.

@alladinian
Created July 13, 2015 13:16
Show Gist options
  • Save alladinian/e3aa1d7469828c5d3bd2 to your computer and use it in GitHub Desktop.
Save alladinian/e3aa1d7469828c5d3bd2 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface A : NSObject
- (void)test;
@end
@implementation A
- (void)test {
NSLog(@"A");
}
@end
@interface SubA0 : A
@end
@implementation SubA0
- (void)test {
NSLog(@"SubA0");
}
@end
@interface SubA1 : A
@end
@implementation SubA1
- (void)test {
NSLog(@"SubA1");
}
@end
int main(int argc, char *argv[]) {
@autoreleasepool {
NSDictionary *dic = [[NSDictionary alloc]initWithObjectsAndKeys:[[SubA0 alloc]init], @"SubA0", [[SubA1 alloc]init], @"SubA1", nil];
[[dic objectForKey:@"SubA0"] test];
[[dic objectForKey:@"SubA1"] test];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment