This is my BankAccount.h file
#ifndef BANKACCOUNT_H_
#define BANKACCOUNT_H_
#include <string>
#include <iostream>
using namespace std;
class BankAccount{
public:
BankAccount();
BankAccount(string n, double b);
string getName();
double getBalance();
virtual void deposit(double a);
virtual bool withdraw(double a);
void toString();
bool transfer(BankAccount *a, double b);
protected:
string name;
double balance;
};
#endif
this is my BankAccount.cpp file
#include <iostream>
#include "BankAccount.h"
#include <string>
using namespace std;
BankAccount::BankAccount(string n, double b){
name = n;
balance = b;
}
string BankAccount::getName(){
return name;
}
double BankAccount::getBalance(){
return balance;
}
void BankAccount::deposit(double a){
balance = balance + a;
}
bool BankAccount::withdraw(double a){
if (balance - a < 0){
return false;
}
else {
balance = balance - a;
}
}
void BankAccount::toString(){
cout << "Name: " << this->getName() << " Balance:" << this->getBalance();
}
bool BankAccount::transfer(BankAccount *a, double b){
if (this->getBalance() - b < 0){
return false;
}
else {
this->withdraw(b);
a->deposit(b);
}
}
this is my SavingsAccount.h file
#ifndef SAVINGSACCOUNT_H_
#define SAVINGSACCOUNT_H_
#include <iostream>
#include <string>
#include "BankAccount.h"
using namespace std;
class SavingsAccount : public BankAccount {
public:
SavingsAccount(string n, double b, double i);
void addInterest();
private:
double interest;
};
#endif
This is my SavingsAccount.cpp file
#include <iostream>
#include "SavingsAccount.h"
#include <string>
using namespace std;
SavingsAccount::SavingsAccount(string n, double b, double i){
name = n;
balance = b;
interest = i;
}
void SavingsAccount::addInterest(){
balance = balance + (interest * balance * .01);
}
I keep getting an undefined reference to BankAccount error. I'm not really sure why, any help would be greatly appreciated. It keeps opening up a makeFile.win with $(CPP) $(LINKOBJ) -o $(BIN) $(LIBS) highlighted.