For various reasons I need to have my next semester of C++ class learn myself so I ask friends who had taken the class for their projects to help me and I'm stuck at this point
So its a game and I have set up 3 classes for the players. The parent Player class, and human and computer class that inherit from the Player class.
Now I'm at the game class and the required attruibute is Player **players, Deck theDeck, int totalPlayers, int dealer. So I assume that the project want me to make an pointer pointer to point to an array or pointers. Then each pointer in the array or pointer will point to each indiviual player data. I get how to do dynamic array but not sure how you do it with pointer.
Is it this?
1 2
Player ** players;
*players = new Player[totalplayer]; //Does this make array of pointers?
And then after I have the array of pointers how do I make the indiviual pointers point to human or computer class?
Have to be done like that? Because I have declared
1 2 3 4 5
Player ** players;
//in the private section of the class, then I want to make a dynamic array do I have to do
Player ** players = new Player*[num]
// Or do I just do something like this?
players = new Player[num]
Also once I have an dynamic array of my Player class how do I make like each part of the array point at different class? Like My Player Class is the parent class, say the user enter there are 5 players total. Going the easier route of default 1 human player and 4 NPC. My dynamic array be 5 and players[0] would point to a human Class that inherit from player class and players[1]-players[4] would point to computer Class that inherit from Player class. How do I set that up?