🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101

Bank management system in C++ (OOP)

Savings and current accounts with deposits, withdrawals and interest, built to show inheritance and virtual functions.

Beginner⏱ 6–9 hoursđŸĒœ 7 stepsC++OOPSTLFile I/O

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. 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. 2

    Derived classes

    SavingsAccount (min balance ₹1000, 4% yearly interest in monthEnd) and CurrentAccount (overdraft limit).

  3. 3

    Store accounts

    std::map<long, std::unique_ptr<Account>> so polymorphism works and memory is freed automatically.

  4. 4

    Transactions

    Record each operation (type, amount, time) in a std::vector inside the account for the statement.

  5. 5

    Menu

    A loop with switch; validate amounts are positive; show clear errors.

  6. 6

    Save and load

    Write one line per account (type, no, name, balance) with std::ofstream; recreate the right class when loading.

  7. 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