C++ Trouble Inputting Data into Private Vector (invalid use)

前端 未结 3 449
梦如初夏
梦如初夏 2021-01-26 00:24

I have a vector of class \"Account\". It\'s private to a class BankingSystem. Here\'s how I have them defined.

Account Class:

struct newAccount
{
string          


        
3条回答
  •  清酒与你
    2021-01-26 01:16

    A static member function doesn't have any special access to member variables like accounts_.

    addAccount and storeAccount are static member functions. You must have made them so for a reason but it was a mistake. Remove that static and you will remove this error. I'm guessing you'll then have a different problem. If so ask another question and find out the right way to solve that.

提交回复
热议问题