Note that there are some explanatory texts on larger screens.

plurals
  1. POan error "has no member named"
    primarykey
    data
    text
    <p>I have this snippet of the code</p> <h3>account.cpp</h3> <pre><code>#include "account.h" #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; Account::Account(string firstName, string lastName, int id) : strFirstName(firstName), strLastName(lastName), nID(id) {} void Account::printAccount(){ cout &lt;&lt; strFirstName; } </code></pre> <h3>account.h</h3> <pre><code>#include &lt;string&gt; using std::string; class Account{ private: string strLastName; //Client's last name string strFirstName; //Client's first name int nID; //Client's ID number int nLines; //Number of lines related to account double lastBill; public: Account(string firstName, string lastName, int id); void printAccount(); }; </code></pre> <h3>company.h</h3> <pre><code>#ifndef CELLULAR_COMPANY_H #define CELLULAR_COMPANY_H #include &lt;string&gt; #include &lt;list&gt; #include &lt;iostream&gt; #include "account.h" using namespace std; class Company { private: list&lt;Account&gt; listOfAccounts; public: void addAccount(string firstName, string lastName, int id) { Account newAccount(firstName, lastName, id); listOfAccounts.push_back(newAccount); } void printAccounts(){ for(list&lt;Account&gt;::iterator i = listOfAccounts.begin(); i != listOfAccounts.end(); ++i){ i.printAccount; //here bug } } }; #endif // CELLULAR_COMPANY_H </code></pre> <h3>main.cpp</h3> <pre><code>#include "cellularcompany.h" int main(){ Company newCompany; newCompany.addAccount("Pavel", "Nedved", 11111); newCompany.printAccounts(); return 0; } </code></pre> <p>can somebody please explain what does my error mean? thanks in advance (I have it in company.h see comment there) I have bug <code>'struct std::_List_iterator&lt;Account&gt;' has no member named 'printAccount'</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload