Guest User

Untitled

a guest
Jun 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public abstract class Pizza {
  2. public static final Pizza.NULL = new Pizza() {
  3. /* "null" implementations */
  4. }
  5.  
  6. /* actual/abstract implmentations */
  7. }
  8.  
  9. @interface NullPizza : NSObject
  10. {
  11. }
  12. - (BOOL)areYouANullPizza;
  13. @end
  14.  
  15. @interface Pizza : NullPizza
  16. {
  17. }
  18.  
  19. + (Pizza*)Null;
  20. @end
  21.  
  22. @implementation Pizza
  23. + (Pizza*)newNullPizza
  24. {
  25. return [[NullPizza]alloc init]; // Singleton code left as an exercise.
  26. }
  27.  
  28. - (BOOL)areYouANullPizza;
  29. {
  30. return NO;
  31. }
  32. @end
Add Comment
Please, Sign In to add comment