I'm trying to read my class file and print it out on my main function,
I get an error saying,
in function 'void account_info(const BankAccount*, int, std::ofstream&, std::ifstream&):
error: request for member 'getFirstname' in 'account', which is of pointer type 'const BankAccount*' (maybe you meant to use '->' ?)
same error for the others
my error starts from,
cout << endl << "The First and Last name is: " << account.getFirstname();
cout << " " << account.getLastname();
cout << endl << "The Account number is: " << account.getAcctNum();
cout << endl << "The Account Type is: " << account.getAcctType();
cout << endl << "The current balance of this account is: " << account.getAcctBalance();
void account_info(const BankAccount account[], int num_accts, ofstream &outfile, ifstream &cin)
{
string ssnum;
int found = 0;
int index;
cout << endl << "Enter the person's Social Security Number: ";
cin >> ssnum;
outfile << endl << "\n\nTransaction Requested: Account Information" << endl;
outfile << "Enter Person's Social Security Number: " << ssnum << endl;
for(index = 0; index < num_accts; index++)
if(account[index].FindSSN(ssnum))
found++;
if(!found)
cout << "The Person's Social Security Number you just input " << ssnum << " is invalid\n";
else
cout << endl << "The First and Last name is: " << account.getFirstname();
cout << " " << account.getLastname();
cout << endl << "The Account number is: " << account.getAcctNum();
cout << endl << "The Account Type is: " << account.getAcctType();
cout << endl << "The current balance of this account is: " << account.getAcctBalance();
return;
}
Don't forget that account is an array, not a single instance of your BankAccount. You need to tell the compiler which element of the array you want use to print the information.