1

I cannot seem to figure out why it is saying ifstream, ostream, and string have not been declared in the code. I #include all three relevant headers, but there is still an error that I can't find. I would appreciate some help with pinpointing why it is doing this, so I can see if my code is functioning properly.

#include <fstream>
#include <string>
#include <ostream>

class Account
{
public:
    void Transaction(ifstream &inStream);
    void Update(ifstream &inStream);
    void SetAccountType(string input)
    {
        AccountType = input;
    }
    friend ostream& operator << (ostream& outputStream,const Account& accountObject);
protected:
    string Name;
    int AccountNum;
    double Balance;
    string AccountType;
};

class CheckingAccount : public Account
{
public:
    CheckingAccount(int AccountNum, string Name, double Balance, double CheckFee);
    void Transaction(ifstream &inStream);
    void Update(ifstream &inStream);
    void SetAccountType(string input)
    {
        AccountType = input;
    }
protected:
    double CheckFee;
    double BounceFee;
    int NumOfChecks;
};

class SavingsAccount : public Account
{
public:
    SavingsAccount(int AccountNum, string Name, double Balance, double Rate);
    virtual void Transaction(ifstream &inStream);
    virtual void Update(ifstream &inStream);
    void SetAccountType(string input)
    {
        AccountType = input;
    }
protected:
    double Rate;
};

SavingsAccount::SavingsAccount(int TheAccountNum, string TheName, double TheBalance,double TheRate)
{
    AccountNum = TheAccountNum;
    Name = TheName;
    Balance = TheBalance;
    Rate = TheRate;
    AccountType = "SavingsAccount";
}
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83

0 Answers0