Say that I have a base class with a class method:
@interface base : NSObject
+(id)method;
@end
And I have 10 derived classes:from derived1 to derived10, each of them overwrite the method:
@interface derived1 : base
@end
now that’s the problem, I have an array like this:
NSArray *array = [NSArray arrayWithObjects:[derived1 class],[derived2
class]…….[derived10 class]];
now I want to iterate through this array and call each element’s method,how to?
PS: I need to perform the method one by one in an foreach loop.
Call the method on that
Edit
The above is if you have concrete instances (@Alladinian 🙂 cheers) otherwise if your example code is literal and you are in fact putting the classes in the array you just use