FROM : Apirak
DATE : Sat Dec 11 10:53:24 2004
Hello,
I try to add two object to myArray by one variable. my source code is
look like this
NSMutableArray *myArray = [[NSMutableArray alloc] init];
Word *word;
word = [[Word alloc] init];
[word setWord:@"test"];
[myArray addObject:word];
word = nil;
word = [[Word alloc] init];
[word setWord:@"test2"];
[myArray addObject:word];
Word *wd = [[myArray objectAtIndex:0] retain];
NSLog(@"word equal %@", [wd getWord]);
wd = [[myArray objectAtIndex:1] retain];
NSLog(@"word equal %@", [wd getWord]);
the result is
word equal test2
word equal test2
but It should be
word equal test
word equal test2
I am java developer, it very hard to deal with vector :(
Apirak Panatkool
e-mail: <email_removed>
phone: 01-4033320
DATE : Sat Dec 11 10:53:24 2004
Hello,
I try to add two object to myArray by one variable. my source code is
look like this
NSMutableArray *myArray = [[NSMutableArray alloc] init];
Word *word;
word = [[Word alloc] init];
[word setWord:@"test"];
[myArray addObject:word];
word = nil;
word = [[Word alloc] init];
[word setWord:@"test2"];
[myArray addObject:word];
Word *wd = [[myArray objectAtIndex:0] retain];
NSLog(@"word equal %@", [wd getWord]);
wd = [[myArray objectAtIndex:1] retain];
NSLog(@"word equal %@", [wd getWord]);
the result is
word equal test2
word equal test2
but It should be
word equal test
word equal test2
I am java developer, it very hard to deal with vector :(
Apirak Panatkool
e-mail: <email_removed>
phone: 01-4033320
| Related mails | Author | Date |
|---|---|---|
| Apirak | Dec 11, 10:53 | |
| Jonathon Mah | Dec 11, 15:17 | |
| Jonathan Jackel | Dec 11, 18:34 | |
| Andrew Merenbach | Dec 12, 10:32 |






Cocoa mail archive

