I’m trying to understand what this is doing in each case. Can someone explain what the first case is doing in detail and how it differs from the second? Thanks // 🙂
//declare in first case
NSManagedObjectModel *mom();
NSManagedObjectModel *mom() {
static NSManagedObjectModel *mom = nil;
//implementation goes here...
return mom;
}
vs.
//no declaration in second case
- (NSManagedObjectModel *) mom {
static NSManagedObjectModel *mom = nil;
//implementation goes here...
return mom;
}
The first is a standalone function; it’s not tied to a class. You’d call it like:
The second is an instance method definition, and thus is defined in the context of a class. You’d call it like: