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

前端 未结 3 489
梦如初夏
梦如初夏 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:02

    The method is static, so it has no "this" pointer, so it has no idea what object you want to access the accounts_ variable of. Also, you will never see that printout on createAccount() because it's after the return call.

提交回复
热议问题