Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
0 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +0,0 @@ | ||
#include <string> | ||
|
||
/** Represent an individuals bank account **/ | ||
class BankAccount | ||
{ | ||
private: | ||
float balance; | ||
|
||
public: | ||
static int number; // see the end of this file for the initialisation of number | ||
std::string name; | ||
|
||
/** Takes account name as input **/ | ||
BankAccount( std::string name ) | ||
{ | ||
this->name = name; | ||
balance = 0.f; | ||
number = number +1; | ||
} | ||
|
||
float get_balance() | ||
{ | ||
return balance; | ||
} | ||
|
||
void deposit( float amount ) | ||
{ | ||
balance += amount; | ||
} | ||
|
||
void withdraw( float amount ) | ||
{ | ||
if( amount <= balance ) | ||
balance -= amount; | ||
} | ||
|
||
/*def transfer(self, other, amount): | ||
if amount <= self.__balance: | ||
self.__balance -= amount | ||
other.__balance += amount*/ | ||
}; | ||
|
||
int BankAccount::number = 0; | ||