I am trying to build a list of games that I have. I have a class named gameCommon
class gameCommon
{
public:
string name;
int price;
}
This is the common information all games have. Now the next part is to build another class which will hold information based on what type of game is it? (CD/DVD, Cartridge, etc.)
if CD/DVD, class will be something like this,
class childClassOf_gameCommon
{
public:
int NumOfDisks;
}
etc.But the thing is, the list itself will be inside a vector of the parent class. Something like vector<gameCommon*>
. So how do I derive childClassOf_gameCommon
so that the list of vector<gameCommon*>
will hold the attributes of gameCommon
and depending on the type, additional information like numOfDisks
.. Sorry for being confusing.