问题
I want the NSMutableArray only store "MyObject" only... ...instead of any objects. How can I do this? thz.
回答1:
There is no concept like C# Generics or C++ Templates in Objective-C, as discussed here before, but you could create a class which exposes an array and has add and remove-methods which take only your object type (see here).
来源:https://stackoverflow.com/questions/2690821/can-i-restrict-the-nsmutablearray-object-type