Confused with object arrays in C++

前端 未结 7 658
后悔当初
后悔当初 2021-01-30 03:56

So I first learned Java and now I\'m trying to switch over to C++. I\'m having a little difficulty getting arrays to work correctly.

Right now I am simply trying to crea

7条回答
  •  有刺的猬
    2021-01-30 04:04

    I would like to propose this as a resolution to the problem of setting value of index 0:

    Player* players = new Player[1];
    players[0] = *(new Player(playerWidth, playerHeight, 20, 1));
    

提交回复
热议问题