The Account class consists of an integer value, the current
balance, a function to add an amount to the account (to
credit) and a function to remove some amount (to
debit). Also, there should be a read and a
write function to read and write the current balance.
Write the C++ header file Account.h for the Account class.
Implement the member functions in Account.C and use them
in the main program (main.C).
Write a constructor that will
initialize the account to a certain value. Use the constructor when
creating instances of an account.
Write operators+=
(credit) and -= (debit). These operators should return the
amount credited/debited. The goal is to be able to write something
like:
a += 10; (credit a with 10)
a += b += 10; (credit a and b with 10)
a += b -= 10; (credit a with 10, debit b with 10 or simply
transfer 10 from b to a)
Write a copy constructor for the Account class. Put a "printf"
call inside and check out when the copy constructor is
called. Try to trigger it in all of the four situations covered in the
lecture.