why do we need a temporary object
As I have seen in many examples, first they allocate memory for the temporary object and later the same object is assigned to self. For example, I have a code snippet here :



- (void)viewDidLoad {
 [super viewDidLoad];
 Movie *newMovie = [[[Movie alloc]
 initWithTitle:@"Iron Man"
 boxOfficeGross:[NSNumber numberWithFloat:650000000.00]
 summary:@"Smart guy makes cool armor" ] autorelease];
 self.movie = newMovie;
 }


Why cant we perform like self.movie =[[[Movie alloc]
 initWithTitle:@"Iron Man"
 boxOfficeGross:[NSNumber numberWithFloat:650000000.00]
 summary:@"Smart guy makes cool armor" ] autorelease];

why do we need a temporary object
===

As I have seen in many examples, first they allocate memory for the temporary object and later the same object is assigned to self. For example, I have a code snippet here :



- (void)viewDidLoad {
 [super viewDidLoad];
 Movie *newMovie = [[[Movie alloc]
 initWithTitle:@"Iron Man"
 boxOfficeGross:[NSNumber numberWithFloat:650000000.00]
 summary:@"Smart guy makes cool armor" ] autorelease];
 self.movie = newMovie;
 }


Why cant we perform like self.movie =[[[Movie alloc]
 initWithTitle:@"Iron Man"
 boxOfficeGross:[NSNumber numberWithFloat:650000000.00]
 summary:@"Smart guy makes cool armor" ] autorelease];
