I want to create an object orange so that I can load everything from a file (by the straight). I'm very new inclined C ++ but I do not know what I'm doing.
What happens: account ** account [50]?
"" account [i] new accounts *;
"" accounts [i] - & gt; New Account (i, id_string, pw_string, level_int);
Error message: request for member 'newAccount' * accounts [i] ', which is non-square type' account * '
AccountManagerFrump.cip // mainfile to run everything
#include "AccountManagerFrm.h" # include "Account.h" # Include "LeadAccounts H" using the namespace CSS; Account ** accounts [50]; Zero Account Manager FROM :: Create Accidental (wxCommandEvent and Event) accounts {accounts [i] = new account *; Account [i] - & gt; New Account (i, id_string, pw_string, level_int); // error line}
account code
class account {struct iAccount {string ID; String password; Integer level; }; Account () {} New account with zero (int angle, string username, string pw, int lvl) {iAccount neu; Neu.ID = Username; Neu.password = pw; Neu.level = lvl; }};
account.h.
#include & lt; String & gt; using namespace std; Class account {public: account (); Zero New Account (Int Engel, String Username, String PW, IntLL); Zero getInformationFromFile (); };
I want to create an object's array of accounts
This is just
account accounts [50];
Your strange array of points from pointers to pointers can then reach you with .
account [i]. Newewaccount (i, id_string, pw_string, level_int);
You will need to fix the class definition. By definition, all the members must be included in the header. In addition, the header should be guarded, if you include headers more than once, to avoid errors. In the global namespace, namespace std;
This is a bad idea to dump; It pollutes the global namespace for everyone, including the header. The whole title should be something
#ifndef ACCOUNT_H # define ACCOUNT_H # & lt; String & gt; Class account {public: account (); Zero New Account (Intang Angel, Standard :: String Username, String Study :: PW, IntLL); Zero getInformationFromFile (); Private: std :: string id; Std :: string password; Integer level; }; #endif
The source file should only define member functions, the whole class should not be redefined:
# account.h "account :: Account Include () {} Zero Account: New Account (Intang Angel, Standard :: String Username, std :: string pw, int lvl) {id = username} password = pw; level = lvl;} < / Code>
If you are struggling with the definitions of the original class, then you should actually read one. This is a complex Language, and you will never learn it by guessing the syntax.
Comments
Post a Comment