If you initialize an NSMutableArray with NSArray’s convenience method as above, do you get an NSArray or an NSMutableArray?
Any consequences?
(I know that NSMutableArray has “arrayWithCapacity:, I’m just curious)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you initialize it using:
you get a NSMutableArray. One great feature of Objective-C is that class methods are inherited by subclasses.
So, in a class method you can do something like this:
and
selfwill be referencing to the class object where the code is executing (NSArrayorNSMutableArray).