I want to have an array of objects. Each object has a constructor with one argument. My object array initialisation :
set s[]=new set[n]; // creates an array of n objects of class set
However, it says that I cannot do so, because my constructor requires an argument. My Constructor:
set(int size){}
I've understood the problem, but cant think of a good solution. What I can do, is either initialise each object seperately :
set s1(size);
set s2(size); //& so on.....
or remove the argument from constructor......both solutions are not quite satisfactory
Can anyone help me out to find a better solution to this ?
Note: 'size' value of each object is different/dynamic