Placing a class object inside a vector?

前端 未结 4 1862
情歌与酒
情歌与酒 2021-01-28 23:43

I noticed that I can place a Class inside a vector; here is my program, where I am receiving the following error:

/out:blackjack.exe
blackjack.obj
blackjack.obj         


        
4条回答
  •  青春惊慌失措
    2021-01-29 00:17

    Your cards vector is defined as static. That means it is effectively a global variable that you must define. This can be done by putting the following after the class definition of Card:

    std::vector Card::Cards();
    

提交回复
热议问题