account: implement deposit, withdraw, and getter
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
bfa3196b62
commit
c89b8f22da
2 changed files with 19 additions and 2 deletions
15
account.cpp
15
account.cpp
|
@ -1,6 +1,4 @@
|
|||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -10,4 +8,17 @@ Account::Account ( double initial_balance ) : balance(initial_balance) {
|
|||
}
|
||||
|
||||
Account::~Account () {
|
||||
cout << "account deleted" << endl;
|
||||
}
|
||||
|
||||
double Account::getBalance() const {
|
||||
return balance;
|
||||
}
|
||||
|
||||
void Account::deposit(double amount) {
|
||||
balance += amount;
|
||||
}
|
||||
|
||||
void Account::withdraw(double amount) {
|
||||
balance -= amount;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue