objective c - NSDate - How does the default initializer allocate space on the heap? -


i know it's practice explicitly alloc , init objects, i'm confused why not needed instances of nsdate in following example:

nsdate *now = [nsdate date]; 

appears same this...

nsdate *now = [[nsdate alloc] init]; 

i assume date class method allocates space on heap, have found nsdate.h , not how apple implemented method.

apple documentation says, "this method uses default initializer method class, init."

+[nsdate date] "convenience constructor". typically implementation similar return [[[self alloc] init] autorelease].


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -