bank account
A C++ class representing a bank account, demonstrating:
- constructors,
- a constant account number,
- methods for deposits, withdrawals and interest,
- friend functions,
- operator overloading.
The program also includes input validation.
The program creates three bank accounts and displays their current
data.
The user can test the first account by choosing:
1 — deposit money
2 — withdraw money
3 — finish.
After finishing, the program displays the updated account balance
and asks whether to add interest.
Finally, all three accounts are displayed using the overloaded <<
operator.
At the end, destructors are called automatically when the objects
are destroyed.
try it on PC
The interactive compiler is available on the desktop version of this page. On a PC, you can run the program and test it directly in the console.
