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
The reason is, type of your variable
players[0]
is Player (object). However, operator "new" (new Player) returns a pointer (Player*)
If you want to have only one object, correct way to do it will be:
Player* player = new Player(playerWidth, playerHeight, 20, 1);
And don't forget in C++ you need to clean the mess after yourself - somewhere in the end call
delete player;
for every object you've created. C++ does not have Garbage Collector - meaning all manually created (by "new") objects stay until you manually delete them.