home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 666 / finance.prx < prev    next >
Text File  |  1994-01-29  |  873b  |  24 lines

  1. // This is an example of inheritance
  2.  
  3. class finance (cash) {
  4.  
  5. receive(amount,source) {cash=cash+amount;
  6.                   inc[source]=inc[source,0]+amount;
  7.                   return "ok";}
  8. spend(amount,reason) {if(amount>cash) return "Insufficient funds";
  9.                  cash=cash-amount;
  10.                  exp[reason]=exp[reason,0]+amount;
  11.                  return "ok";}
  12. totalrec(source) {return inc[source,0];}
  13. totalspent(reason) {return exp[reason,0];}
  14. cashonhand() {return cash;}};
  15.  
  16. class deduct_class (cash;deductible) : finance {
  17.  init() {deductible = 0;}
  18.  spend_deduct(amount,reason) {deductible = deductible + amount;
  19.                               spend(amount,reason);}
  20.  spend_for_deduct(amount,reason,deduct) {deductible = deductible + deduct;
  21.                               spend(amount,reason);}
  22.  total_deduct() {return deductible;}};
  23. end
  24.