http://www.cocoachina.com/applenews/devnews/2014/0530/8622.html
- NSString *string1 = @"helloworld";
- NSString *string2 = [[NSString alloc] initWithFormat:@":%@", @"helloworld"];
- NSString *string3 = [NSHomeDirectory() stringByAppendingPathComponent:string1];
- NSTextStorage *storage = [[NSTextStorage alloc] initWithString:string1];
- NSString *string4 = [storage string];
- NSLog(@"%@", [[string1 class] description]);
- NSLog(@"%@", [[string2 class] description]);
- NSLog(@"%@", [[string3 class] description]);
- NSLog(@"%@", [[string4 class] description]);
- _NSCFConstantString
- _NSCFString
- NSPathStore2
- NSBigMutableString
An abstract class is a class which is not fully functional on its own. It must be subclassed, and the subclass must fill out the missing functionality.
An abstract class is not necessarily an empty shell. It can still contain a lot of functionality all on its own, but it’s not complete without a subclass to fill in the holes.
Mike Ash Friday Q&A 2010-03-12: Subclassing Class Clusters
|
A class cluster is a hierarchy of classes capped off by a public abstract class. The public class provides an interface and a lot of auxiliary functionality, and then core functionality is implemented by private subclasses. The public class then provides creation methods which return instances of the private subclasses, so that the public class can be used without knowledge of those subclasses.
Mike Ash Friday Q&A 2010-03-12: Subclassing Class Clusters
|
The class cluster architecture involves a trade-off between simplicity and extensibility: Having a few public classes stand in for a multitude of private ones makes it easier to learn and use the classes in a framework but somewhat harder to create subclasses within any of the clusters.
Apple Develpoer Document Cocoa Core Competencies
|
- + (id)alloc {
- if ([self class] == [SFSSearchTVC class]) {
- if ([UIDevice currentDevice] systemMajorVersion] < 7) {
- return [SFSSearchTVC6 alloc];
- } else if ([UIDevice currentDevice] systemMajorVersion] == 7) {
- return [SFSSearchTVC7 alloc];
- }
- }
- return [super alloc];
- }