I need help, if I have:
class gameObject{
public: //get and set;
private: int x;
int y;
string texture;
}
class gun:public gameObject{
public: //get and set;
private: int ammo;
}
class armor:public gameObject ... ,
class boots:public gameObject...
How I can create a linked list of multiple derived objects from base class gameObject ? For example user have a menu: [1. Add object 2.Delete object]. If user choose 1 another menu appear [Type: 1-Gun 2-Armor]. After 4 objects added the list will be: 1.Gun 2.Armor 3.Gun 4.Boots. I need an example to understand the concept.
Thanks.
std::list<gameObject*>std::list<std::unique_ptr<GameObject>>