诡异的Objective-C

感觉Objective-C 真的很格斯! 让我这个写C++的情何以堪啊

 

 

 

#import <Foundation/Foundation.h> @interface Main: NSObject { int Number; int i,j; } -(void) setI:(int) ii andJ:(int) jj; -(void)print; @property int Number; @end @implementation Main @synthesize Number; -(void) setI:(int) ii andJ:(int) jj { i=ii; j=jj; } -(void)print { NSLog(@"Hello World @%d/r" , Number); } @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; Main * obj=[Main alloc]; [obj init]; [obj setI:19 andJ:20]; [obj setNumber:21]; [obj print]; [obj release]; [pool drain]; return 0; }  

 

不过有点明白写Mac应用的为什么都。。。。 怎么说呢。。与众不同???

 

 

你可能感兴趣的:(c,interface)