A console-based bank account management system written in modern C++ (C++17). It supports multiple account types, fund transfers, transaction history, and persistent storage between sessions — built to demonstrate object-oriented design, not just a single-file script.
- Multiple account types —
SavingsAccount(enforces a minimum balance) andCheckingAccount(allows a configurable overdraft), both derived from an abstractAccountbase class. - Core banking operations — open an account, deposit, withdraw, and transfer funds between accounts.
- Transaction history — every operation is logged with a timestamp and the resulting balance, viewable per account.
- Custom exception hierarchy —
InsufficientFundsException,InvalidAmountException, andAccountNotFoundExceptiongive precise, catchable error handling instead of generic error codes. - Data persistence — accounts and their transaction history are saved to disk on exit and reloaded automatically on the next run.
- Input validation — the console menu safely re-prompts on invalid input instead of crashing or looping.
SecureBank/
├── include/
│ ├── Account.h # Abstract base class
│ ├── SavingsAccount.h # Minimum-balance account
│ ├── CheckingAccount.h # Overdraft-enabled account
│ ├── Transaction.h # Single ledger entry
│ ├── Bank.h # Owns and manages all accounts
│ └── Exceptions.h # Custom exception types
├── src/
│ ├── Account.cpp
│ ├── SavingsAccount.cpp
│ ├── CheckingAccount.cpp
│ ├── Transaction.cpp
│ ├── Bank.cpp
│ └── main.cpp # Console menu / entry point
├── CMakeLists.txt
├── SecureBank.sln # Visual Studio solution
├── SecureBank.vcxproj
└── SecureBank.vcxproj.filters
Design decisions worth noting:
Accountis abstract (withdraw()andgetAccountType()are pure virtual) because withdrawal rules genuinely differ between account types — a savings account can't go below its minimum balance, while a checking account can dip into its overdraft limit. This is a textbook case for polymorphism rather than a chain ofifstatements checking account type.Bankusesstd::vector<std::unique_ptr<Account>>for ownership, so accounts are automatically cleaned up and can't be accidentally copied or aliased.- Transfers withdraw from the source account before depositing into the destination, so a failed withdrawal (insufficient funds) aborts the whole transfer cleanly — no partial state.
mkdir build && cd build
cmake ..
cmake --build .
./SecureBank # or SecureBank.exe on WindowsOpen SecureBank.sln in Visual Studio 2022, select a configuration (Debug/Release, x64/x86), and press F5 or Ctrl+F5.
========== SecureBank ==========
1. Open a savings account
2. Open a checking account
3. Deposit
4. Withdraw
5. Transfer between accounts
6. View account summary
7. View transaction history
8. View all accounts
9. Save and exit
=================================
Enter your choice: 1
Enter account holder name: Botlhale Nthite
Enter opening deposit: R1000
Savings account created. Account number: 1001
- PIN/password authentication per account
- Interest accrual over time for savings accounts (the interest rate is already modeled but not yet applied automatically)
- Unit tests (e.g. with Catch2 or GoogleTest) for the withdrawal/transfer edge cases
- A simple GUI or web front end
Botlhale Nthite — github.com/BotlhaleOa