I want to create a object array of Accounts so I can manage them load everything from a file (by struct). Im pretty new leaning c++ but I have no idea what I am doing wrong.
What does: Account** accounts[50] ?
"" accounts[i] = new Account*;
"" accounts[i]->newAccount(i, id_string, pw_string, level_int);
ERROR MESSAGE: request for member 'newAccount' in '* accounts[i]', which is of non-class type 'Account*'
AccountManagerFrm.cpp // Mainfile to run everything
#include "AccountManagerFrm.h"
#include "Account.h"
#include "ladeAccounts.h"
using namespace std;
Account** accounts [50];
void AccountManagerFrm::createAccountClick(wxCommandEvent& event)
{
accounts[i] = new Account*;
accounts[i]->newAccount(i, id_string, pw_string, level_int); // ERROR LINE
}
Account.cpp
class Account
{
struct iAccount
{
string ID;
string password;
int level;
};
Account()
{
}
void newAccount(int anzahl, string username, string pw, int lvl)
{
iAccount neu;
neu.ID = username;
neu.password = pw;
neu.level = lvl;
}
};
Account.h
#include <string>
using namespace std;
class Account{
public:
Account();
void newAccount(int anzahl, string username, string pw, int lvl);
void getInformationFromFile();
};