#include <iostream>
#include <string>
using namespace std;
class account {
public:
double credit(account account, double add);
double debit(account account, double withdraw);
double getBalance(account account);
double addAccountBalance(account account1, account account2);
account() {
balance = 0;
}
account::account (){
if (balance <= 0){
cout << "Initial balance was invalid!" ;
balance = 0;
}
}
private:
double balance;
};
int main(){
so the project i have is to create two bank accounts. the problem am having is how do I create class account objects and initialize one with the default constructor (account) and one with the other one (account::account). for the default constructor am not talking about the implicit constructor the compiler uses. but about the one i have down there. I want to be able to use these variables down in main. the first constructor. the default. sets the balance to 0 and the second one sets it to zero if the balance is a negative number;
basically create one account with the default and another with the non-default constructor.