You need to log in to create posts and topics.
FBCocoaTutorial
1,678 Posts
#1 · September 4, 2011, 12:24 am
Quote from Forum Archives on September 4, 2011, 12:24 amPosted by: fblistserve <fblistserve@...>
On Sep 3, 2011, at 6:12 PM, Edwards, Waverly wrote:
I believe "new" and [[ object alloc] init] are equivalent.
If you do not have a custom allocator then you are using the the default allocator.
"new" just performs the same allocation and initializing job. Its just shorter.Also, it is possible a given implementation might need a custom initialization for object. In that case you would want to call it with [[obj alloc] init] to pick up the instance method that does the custom init. The default initialization from the class method ( i.e. '+new' from NSObject) might not be what is desired even though sufficient for most needs.Brian S
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Posted by: fblistserve <fblistserve@...>
On Sep 3, 2011, at 6:12 PM, Edwards, Waverly wrote:
I believe "new" and [[ object alloc] init] are equivalent.
If you do not have a custom allocator then you are using the the default allocator.
"new" just performs the same allocation and initializing job. Its just shorter.
Also, it is possible a given implementation might need a custom initialization for object. In that case you would want to call it with [[obj alloc] init] to pick up the instance method that does the custom init. The default initialization from the class method ( i.e. '+new' from NSObject) might not be what is desired even though sufficient for most needs.
Brian S
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Click for thumbs down.0Click for thumbs up.0