Okay, I understand, thanks. How do I construct the vector as a member variable of the class with the other stuff then? I tried the following but it doesn't work. It compiles with just the constructor but not when I try to create a cretin object.
Code:
#include <iostream>
#include <vector>
#include <list>
#include <string>
using namespace std;
class cretin {
private:
string name;
int id;
vector<int> status;
public:
cretin(const string& nm, int i, vector<int> s)
{
name = nm;
id = i;
status = s;
}
void cretin::getstatus(int x)
{
cout<<status[x]<<" ";
}
};
int main()
{
list<cretin> cretinlist;
cretin arnold("arnold", 1, (1, 1));
cretinlist.push_back(arnold);
list<cretin>::iterator iter2 = cretinlist.begin();
iter2->getstatus(1);
return 0;
}