Quantcast
Channel: C++: Array of parent and child objects - Stack Overflow
Viewing all articles
Browse latest Browse all 3

C++: Array of parent and child objects

$
0
0

I am designing a game in which some players cards are known and some aren't. To do this, I made a parent object "Player" with children "OpenPlayer" and "ClosedPlayer".

I want to make an array of all the players in this game to facilitate game management. However, I also want to be able to access the special methods in OpenPlayer and ClosedPlayer as appropriate. Is this possible?

Edit: I am actually thinking of using a vector from STL as this would likely be more appropriate due to variable number of players.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>