class widget
{
public:
int id;
widget()
{
id = -100;
}
};
class foo
{
public:
string name;
int age;
vector <vector <widget>> something;
vector <widget> somethingelse[10];
foo()
{
name = "noname";
age = 0;
}
};
Now, in my program, I create an instance offoo as follows:
1 2 3 4
foo fooey;
vector <vector<widget>> widgety; //Try this to check a default output
cout << fooey.something[0][0].id << endl; //output1
cout << fooey.somethingelse[0][0].id << endl; //output2
Programs crashes and reports an unprecedented error meesage.
What's the problem: vector<widget> anotherthing[10] must create a 10-element array of type widget, and each id value of these widgets must be -100;
Why isn't that happening?
I'm confused.