Bank management system in C++ (OOP)
Savings and current accounts with deposits, withdrawals and interest, built to show inheritance and virtual functions.
What you'll learn
- âInheritance and virtual functions
- âstd::map and smart pointers
- âSaving objects to files
What you'll build
- âOpen savings or current accounts
- âDeposit, withdraw (with overdraft for current)
- âMonthly interest for savings
- âStatement and saved data
Step-by-step guide
- 1
Base class
class Account { protected: long no; std::string name; double balance; public: virtual bool withdraw(double); virtual void monthEnd(); virtual ~Account() = default; };
- 2
Derived classes
SavingsAccount (min balance âš1000, 4% yearly interest in monthEnd) and CurrentAccount (overdraft limit).
- 3
Store accounts
std::map<long, std::unique_ptr<Account>> so polymorphism works and memory is freed automatically.
- 4
Transactions
Record each operation (type, amount, time) in a std::vector inside the account for the statement.
- 5
Menu
A loop with switch; validate amounts are positive; show clear errors.
- 6
Save and load
Write one line per account (type, no, name, balance) with std::ofstream; recreate the right class when loading.
- 7
Explain the design
Write a short README with a class diagram; interviewers love asking "why virtual?".
đ Make it stand out
- +Transfer between accounts
- +Admin login
- +Port the storage to SQLite