I don't know this question makes any sense. But I wanna know how we can create new instance for an NSObject
without using any initializers.
I have seen that I can create new NSMutableArray
like this two ways.
NSMutableArray *myArray = [[NSMutableArray alloc]init];
Generally I will create an instance for my NSObject
like above using init:
method or any other designated initializers.
But I don't know how to create a method like below example..
NSMutableArray *myArray = [NSMutableArray array];
I have seen the documentation for NSMutableArray
and it is a subclass of NSArray
. And also NSArray
having a method like this to achieve an above example.
+(id)array;
But I wanna know what could the code inside of the array:
method. Otherwise how to write a method same as like that for my own NSObject
?? Before vote down ask me, if you want more explanation.