Skip to content

Instantly share code, notes, and snippets.

@tedheich
Created October 23, 2009 05:40
Show Gist options
  • Save tedheich/216682 to your computer and use it in GitHub Desktop.
Save tedheich/216682 to your computer and use it in GitHub Desktop.
Hello World in Objective C
// Hello.h
#import <Foundation/Foundation.h>
@interface Hello: NSObject {
}
- (void) sayhello ;
@end
// Hello.m
#import "Hello.h"
#import <Foundation/Foundation.h>
@implementation Hello
- (void) sayhello {
printf("Hello World\n");
}
@end
// HelloMain.m
#import <Foundation/Foundation.h>
#import "Hello.h"
int main(void){
Hello *helloobj = [[Hello alloc] init];
[helloobj sayhello];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment