I would like to know C++ way of creating multiple indefinite number of objects (0..n) automatically. The use case is as below:
Let say I have a script that a user has to enter related data (width, length, height) that later on Box class will contain those data.
Box
{
...
...
double width;
double length;
double height;
...
...
}
The script looks like:
<id="width" value="1"/>
<id="length" value="3"/>
<id="height" value="3"/>
<id="width2" value="3"/>
<id="length2" value="3"/>
<id="height2" value="4"/>
<id="width3" value="2"/>
<id="length3" value="3"/>
<id="height3" value="3"/>
In other words, how can I instantiate those object which number of the objects is not known in advance, rather, it depends on how many box information (width and so on) is entered by the user.
Also, is there any design pattern for that?