Hi guys,
im new to objective-c (have experience with C and C++). This might be a really stupid question but i don't quiet get the use of Class methods VS object methods (+xxx or -xxx) methods in a class.
EXAMPLE:
i know that code below returns the current date, stores it in date and we can print it to the log.
NSDate *date = [NSDate date];
but how do i use -init. the apple docs say
Returns an NSDate object initialized to the current date and time.
- (id)init
Return Value
An NSDate object initialized to the current date and time.
and for +date it says
Creates and returns a new date set to the current date and time.
+ (id)date
Return Value
A new date object set to the current date and time.
so whats going on??? whats the difference? they both return an object dont they??? thanks for the help
im new to objective-c (have experience with C and C++). This might be a really stupid question but i don't quiet get the use of Class methods VS object methods (+xxx or -xxx) methods in a class.
EXAMPLE:
i know that code below returns the current date, stores it in date and we can print it to the log.
NSDate *date = [NSDate date];
but how do i use -init. the apple docs say
Returns an NSDate object initialized to the current date and time.
- (id)init
Return Value
An NSDate object initialized to the current date and time.
and for +date it says
Creates and returns a new date set to the current date and time.
+ (id)date
Return Value
A new date object set to the current date and time.
so whats going on??? whats the difference? they both return an object dont they??? thanks for the help