home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 12
/
CD_ASCQ_12_0294.iso
/
maj
/
666
/
finance.prx
< prev
next >
Wrap
Text File
|
1994-01-29
|
873b
|
24 lines
// This is an example of inheritance
class finance (cash) {
receive(amount,source) {cash=cash+amount;
inc[source]=inc[source,0]+amount;
return "ok";}
spend(amount,reason) {if(amount>cash) return "Insufficient funds";
cash=cash-amount;
exp[reason]=exp[reason,0]+amount;
return "ok";}
totalrec(source) {return inc[source,0];}
totalspent(reason) {return exp[reason,0];}
cashonhand() {return cash;}};
class deduct_class (cash;deductible) : finance {
init() {deductible = 0;}
spend_deduct(amount,reason) {deductible = deductible + amount;
spend(amount,reason);}
spend_for_deduct(amount,reason,deduct) {deductible = deductible + deduct;
spend(amount,reason);}
total_deduct() {return deductible;}};
end