why NSNumber didn't show correct number
Sorry,my company mac is English version,so I have to speak English in CSDN even though I'm Chinese.
Here is my code.
A.h
#import <Cocoa/Cocoa.h>
@interface A : NSObject {
NSNumber* i;
}
@property (retain) NSNumber* i;
@end
#import "A.h"
@implementation A
@synthesize i;
-(void)dealloc{
[i release];
[super dealloc];
}
#import <Foundation/Foundation.h>
#import "A.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
A *a=[[A alloc] init];
NSNumber* i=[[NSNumber alloc] initWithInt:123];
[a setI:i];
NSLog(@"i is %d",[a i]);
[pool drain];
return 0;
}