class widget
{
public:
int id;
int array[10];
intoperator[](int index) {return array[index];}
};
Now I've accross something interesting is that the [] operator when using an array or (static or dynamic, ie vector) can be used as a setter and getter, i.e.
1 2 3
int array[5] = {0, 10, 20, 30, 40};
array[2] = 200; //changes 2nd element to 200
cout << array[2]; //returns 2nd element