Hello folks,
I understand that it is at least a good practice in Obj-C and Cocoa to initialize all new class instances prior to first use:
NSString *myString;
myString = [[NSString alloc [init]];
If so, how can we understand the validity of a statement such as the following (without previous alloc and init calls):
NSString *myString = [anotherString uppercaseString];
Does the "equals" operator imply automatic calls to alloc and init? And if so, is this true for any class, or only for certain classes?
Thank you?
I understand that it is at least a good practice in Obj-C and Cocoa to initialize all new class instances prior to first use:
NSString *myString;
myString = [[NSString alloc [init]];
If so, how can we understand the validity of a statement such as the following (without previous alloc and init calls):
NSString *myString = [anotherString uppercaseString];
Does the "equals" operator imply automatic calls to alloc and init? And if so, is this true for any class, or only for certain classes?
Thank you?