I'm trying the following code to create an instance, assign properties, add to array. Then, assigning new properties and adding again. However array will contain 2 identical objects (equal to the second one added). The class Message simply has several (nonatomic, retain) NSStrings/Integer properties. This probably has something to do with my understanding of pointer, can someone explain?
self.messages=[[NSMutableArray alloc]init];
Message *m=[[Message alloc]init];
m.cb=@"2402";
m.ck=1001;
m.msg=@"as";
[self.messages addObject:m];
m.cb=@"2422";
m.ck=1002;
m.msg=@"aadfsdsdfdssdklsdflkh";
[self.messages addObject:m];
NSLog(@"%@",self.messages);