I'm a c++ & c programmer , and i'm new to the world of objective-C , so i have some problem understanding how it works , here a short code , that confused me,
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSDate *now = [NSDate date];
NSLog(@"The date is %@", now);
double seconds = [now timeIntervalSince1970];
NSLog(@"It has been %f seconds since the start of 1970.", seconds);
}
return 0; }
now is pointer to an object type NSdate my question is why we can not do this :
double seconds = [NSDate timeIntervalSince1970];
normally the first part is the type of the object and the second part is the method i'm sorry if this is a bad question but i want to understand Objective-C very well from the begining. Thanks