Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. - (id)init
  2. {
  3. self = [super init];
  4.  
  5. if (self)
  6. {
  7. //do some initialisations
  8. }
  9.  
  10. return self;
  11. }
  12.  
  13. + (id)new
  14. {
  15. id object = [super new];
  16.  
  17. if (object)
  18. {
  19. //do some initialisations
  20. }
  21.  
  22. return object;
  23. }
  24.  
  25. + (id)new
  26. {
  27. return [[self alloc] init;
  28. }
  29.  
  30. - (id) init
  31. {
  32. // init code
  33. }
  34.  
  35. - (id) initWithName:(NSString *)name
  36. {
  37. // init code
  38. }
  39.  
  40. + (id) personWithName:(NSString *)name
  41. {
  42. // add autorelease on non-ARC
  43. return [[super alloc] initWithName:name];
  44. }
  45.  
  46. Person *person = [Person personWithName:@"Steve Jobs"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement