// A bank account class #include "stdafx.h" #include class Account { // private members are those that cannot be changed directly by the owner // of the account. The bank has access to them and may change them. private: double balance; public: // public access // here the public or account user can change the // balance only by depositing cash (using deposit function) // or by withdrawing cash (using withdraw) void withdraw(double amount) // withdraw cash { balance = balance - amount;} void deposit(double amount) // deposit cash { balance = balance + amount;} void printBalance() { std::cout << " Balance is " << balance << " \n"; } // constructor function with default balance Account(double initial_balance=0) { balance = initial_balance; } }; int main() { // create an account Account currentAccount; // deposit some money currentAccount.deposit(150); // display balance currentAccount.printBalance(); }