Cocoa Snippet
Factory
+ (BrandingFactory *) factory { #if defined (USE_ACME) return [[[AcmeBrandingFactory alloc] init] autorelease]; #elif defined (USE_SIERRA) return [[[SierraBrandingFactory alloc] init] autorelease]; #else return nil; #endif }
Copy
- (id)copyWithZone:(NSZone *)zone { Dot *dotCopy = [[[self class] allocWithZone:zone] initWithLocation:location_]; // copy the color [dotCopy setColor:[UIColor colorWithCGColor:[color_ CGColor]]]; // copy the size [dotCopy setSize:size_]; return dotCopy; }