+alloc , , -release -autorelease . , API . +URLWithString: , :
+ (id)URLWithString: (NSString *)str {
return [[[self alloc] initWithString: str] autorelease];
}
+alloc , -autorelease.
Objective-C : . . , . +; -.
+alloc - . - . , , - :
+ (id)alloc {
id result = malloc(class_getInstanceSize(self));
if (result) {
memset(result, 0, class_getInstanceSize(self));
result->isa = self;
result->retainCount = 1;
}
return result;
}
( , .) , +alloc NSObject, . Cocoa , +alloc, -init, -retain, -release .. Objective-C, , .
+alloc, . .