In short, I've created a bank object. Using my CreateBank() method.
Bank* Program::CreateBank()
{
//Creates a new Bank object.
Bank *bank = new Bank();
return bank;
}
Then, when the bank has been successfully created, I basically want to be able to pass it to any other method -- It's next location should be the PopulateBank() method which will fill it with information.
void Program::PopulateBank(Bank* bank)
{
bank->populate();
}
However, the PopulateBank() method currently cannot be compiled. I have the following error preventing me from doing so:
"A nonstatic member ference must be relative to a specific object"
Here is the code I'm using for my calls:
void Program::TestBankClass()
{
//Creates new bank Object.
//Populates the bank object.
//lists customers that were populated with all information.
Bank* bank = CreateBank();
PopulateBank(bank);
ListAllCustomers(bank);
And here's my header file:
class Program
{
public:
static void AccountTester();
static void TransactionTester();
static void CreditAccountTester();
static void TestCustomerClass();
static void TestBankClass();
void ListAllCustomers(Bank* bank);
Bank* Program::CreateBank();
void PopulateBank(Bank* bank);
};
Anyone know what I'm doing wrong? or could give me some tips? would really appreciate it!