Last active
January 4, 2016 16:29
-
-
Save chitan/8648172 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "MyClass.h" | |
@interface ChildClass : MyClass | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ChildClass.h" | |
@implementation ChildClass | |
- (void)method | |
{ | |
NSLog(@"Hello ChildClass!"); | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "MyClass.h" | |
#import "ChildClass.h" | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
MyClass *myclass = [[MyClass alloc]init]; | |
[myclass callMyClassSelfMethod]; //Hello MyClass! | |
[myclass callMyClassSuperMethod]; //Hello ParentClass! | |
ChildClass *childclass = [[ChildClass alloc]init]; | |
[childclass callMyClassSelfMethod]; //Hello ChildClass! | |
[childclass callMyClassSuperMethod]; //Hello ParentClass! | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "ParentClass.h" | |
@interface MyClass : ParentClass | |
- (void)callMyClassSelfMethod; | |
- (void)callMyClassSuperMethod; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "MyClass.h" | |
@implementation MyClass | |
- (void)method | |
{ | |
NSLog(@"Hello MyClass!"); | |
} | |
- (void)callMyClassSelfMethod | |
{ | |
[self method]; | |
} | |
- (void)callMyClassSuperMethod | |
{ | |
[super method]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface ParentClass : NSObject | |
- (void)method; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ParentClass.h" | |
@implementation ParentClass | |
- (void)method | |
{ | |
NSLog(@"Hello ParentClass!"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment