Can I put different types of objects in the same NSMutableArray?

后端 未结 3 762
别那么骄傲
别那么骄傲 2021-02-14 00:19

I have classes A and B.
Can I put these classes in the same NSMutableArray without problems in future?

Example:

NSMutableArray *maincoll = [[NSMutabl         


        
3条回答
  •  温柔的废话
    2021-02-14 01:11

    You can put objects of different classes. They just need to inherit from NSObject. Don't forget to release after adding to the array.

提交回复
热议问题