Guest User

Untitled

a guest
May 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #import "List.h"
  2.  
  3. @implementation List
  4.  
  5. + new // factory method
  6. {
  7. self = [super new];
  8. [self resetSize];
  9. return self;
  10. }
  11.  
  12. - free
  13. {
  14. return [super free];
  15. }
  16.  
  17. - (int) addEntry: (int) num
  18. {
  19. list[size++] = num;
  20. return size;
  21. }
  22.  
  23. - print
  24. {
  25. int i;
  26.  
  27. printf("\n");
  28. for (i = 0; i < size; ++i)
  29. printf ("%i ", list[i]);
  30. return self; // Always return self
  31. // if nothing else makes sense.
  32. }
  33.  
  34. - resetSize
  35. {
  36. size = 0;
  37. return self;
  38. }
Add Comment
Please, Sign In to add comment