tags:

views:

17

answers:

1

I have "Man" class which also has 2 variable : "description" and "name". At a point, I created Man class and initialize with its own variables (description and name) and pass it to NSMutableArray "collector". How can I access description now ? I tried but ı could not get the property

+1  A: 

If I understand you correctly, the Man object will now be an object in the collector array. If so, you would access it like:

Man *man = [collector objectAtIndex:42];
NSString *description = [man description];

42 is just an arbitrary index, and objectAtIndex: is just one method to access an object in an array (any number of other ways could be used). In the second statement, I've also assumed that you have declared description and name as properties of the Man class, so that they can be accessed from other classes via accessors/mutators (a.k.a getters/setters).

Steve Harrison
very thanks man !!