Squash commits for public release
This commit is contained in:
41
userland/tests/testobjc/main.mm
Normal file
41
userland/tests/testobjc/main.mm
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <libfoundation/NSObject.h>
|
||||
#include <libobjc/helpers.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@interface SampleClass : NSObject {
|
||||
@public
|
||||
int last_val;
|
||||
}
|
||||
+ (void)sampleMethod;
|
||||
- (void)sampleMethod:(int)val;
|
||||
- (int)get_last;
|
||||
@end
|
||||
|
||||
@implementation SampleClass
|
||||
|
||||
+ (void)sampleMethod
|
||||
{
|
||||
printf("Calling static: Hello, from Obj-C!");
|
||||
}
|
||||
|
||||
- (void)sampleMethod:(int)val
|
||||
{
|
||||
last_val = val;
|
||||
printf("Calling method: Hello, Obj-C! %d", val);
|
||||
}
|
||||
|
||||
- (int)get_last
|
||||
{
|
||||
return last_val;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main()
|
||||
{
|
||||
id objectAlloc = [[SampleClass alloc] init];
|
||||
[objectAlloc sampleMethod:22];
|
||||
[SampleClass sampleMethod];
|
||||
printf("Last called with %d", [objectAlloc get_last]);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user