Just answered a question on DreamInCode Forums and thought it might as well be here too. Just a very basic Account class for C++
#ifndef ACCOUNT_H_INCLUDED #define ACCOUNT_H_INCLUDED class Account { public: Account(int initial_balance); void deposit( int amount); void withdraw( int amount ); int getBalance(); private: int balance; }; Account::Account( int initial_balance ) { balance = initial_balance; } void Account::deposit( int amount ) { balance += amount; } void Account::withdraw( int amount ) { if ( amount > balance ) return; else balance -= amount; } int Account::getBalance() { return balance; } #endif
