I want to ask a question about the objective C. When I study the library from the apple developer website. I always see that there are some subclass called “mutable”. For example, the NSArray and NSMutableArray. What does it mean about this word. Are there some special meaning? Can anyone tell me? Thank you.
Share
It means you can change its values. If you look at the NSMutableArray docs, you’ll see it defines extra methods like
-addObject:. NSArray by itself doesn’t have these (and can thus be more efficient / take less memory in implementation).Also note, if you call
[myMutableArray copy]you’ll get a non-mutable copy of it (which you must later release0. And similarly there’s-mutableCopy.