I have been looking around for a while trying to under stand how to have a class, then how to also have a dynamic array in it.
I am trying to build a bank account c++ program that will make a unlimited number of accounts (memory is the only limit), so i want a dynamic array, where say, p[1] is the first account then p[2] is the second account and and to have it be a member of the bankAccount class. So that i can have the array at memory location 1, aka account number 1, and then also have other info like first last name, balance and etc associated with it. maybe something like if i have array p[] in class bankAccount,then i can use p[1].name.
I am new to this site, if there are better ways to ask questions or post code examples, please feel free to tell me.
This is the main part that i am having trouble with, declaring the dynamic array as a member of the class:
class bankAccount
{
int i;
int index;
int AccountNum;
double balance;
string last;
string first;
public:
void intro();
void deposit();
void withdraw();
void newAcc ();
void editAcc();
void chgAcc();
void print();
bankAccount::bankAccount();
}p [10]; // This is what i want to be dynamic
Thank you.
bankAccount::bankAccount();statement in main (at least) is invalid.