I want to create a vector of pointers that each point to their own Martian object but i can't figure out how to arrange it. I'm currently getting the error
Non-const lvalue reference to type 'vector' cannot bind to a value of unrelated type 'martianDatabase'
but the error constantly changes with every change i make. I've watched a ton of tutorials the last two days trying to figure this out but I'm still stuck.
struct Martian
{
Martian(string fname, string lname, string ssid);
string fname, lname, ssid;
~Martian();
};
class martianDatabase
{
vector<Martian*> database;
martianDatabase();
void addMartian(vector <Martian*> &database, int &iterator, string f, string l, string id);
int iterator = 0;
};
Martian::Martian(string f, string l, string id)
{
fname = f;
lname = l;
ssid = id;
}
void martianDatabase::addMartian(vector <Martian*> &database, int &i, string f, string l, string id)
{
Martian* m = new Martian(f, l, id);
database[i].push_back(m);
i++;
}