Possible Duplicate:
alloc, init, and new in Objective-C
I am a little confused about [Class new]
and [[Class alloc] init]
. I have defined an object content
using [Class new]
and [[Class alloc] init]
.
(1). NSMutableArray *content = [NSMutableArray new];
(2). NSMutableArray *content = [[NSMutableArray alloc] init];
My question is about the differences between [Class new]
and [[Class alloc] init]
. For me, (1) and (2) are similar. If (1) and (2) are similar, then why do we use [[Class alloc] init]
most of the time, compared to [Class new]
? I think that there must be some difference.
Kindly explain the differences, pros & cons of both?