home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_09 / pugh / object.c < prev   
Encoding:
Text File  |  1994-07-14  |  1011 b   |  70 lines

  1. @C SOURCE 8 = /* Entry Object */<R>
  2. <R>
  3. #import <<Object.h>><R>
  4. <R>
  5. @interface Entry : Object<R>
  6. {<R>
  7.   double amount;<R>
  8.   id acct;<R>
  9. }<R>
  10. <R>
  11. + new;<R>
  12. <R>
  13. -setAmount:(double)theAmt;<R>
  14. -(double)getAmount;<R>
  15. -postEntry;<R>
  16.  .<R>
  17.  .<R>
  18. @end<R>
  19. <R>
  20. /* Entry Object */<R>
  21. <R>
  22. #import <<Entry.h>><R>
  23. <R>
  24. @implementation Entry<R>
  25. <R>
  26. + new<R>
  27. {<R>
  28.    [super new];<R>
  29. }<R>
  30. -init;<R>
  31. {<R>
  32.   acct = [Account new];<R>
  33. }<R>
  34. -setAmount:(double)theAmt<R>
  35. {<R>
  36.    amount = theAmt;<R>
  37. }<R>
  38. -(double)getAmount<R>
  39. {<R>
  40.    return amount;<R>
  41. }<R>
  42. -postEntry<R>
  43. {<R>
  44.   [acct debitBalance:amount];<R>
  45.   //subtract<R>
  46. }<R>
  47.  .<R>
  48. @end<R>
  49. <R>
  50. /* main */<R>
  51. <R>
  52. #import <<Entry.h>><R>
  53. <R>
  54. main(void)<R>
  55. {<R>
  56.   id Check;<R>
  57.  
  58.  
  59. @C SOURCE 8 =   Check = [Entry new];<R>
  60.   [Check setAmount: 12.56];<R>
  61.   [Check setPayee: "MediaScape"];<R>
  62.   [Check postEntry];<R>
  63.   // [Account postEntry: check];<R>
  64.   .<R>
  65.   [Check storeOn: "Entry.io"];<R>
  66. <R>
  67. }<R>
  68. /* End of File */
  69.  
  70.