Hi all,
I have an object Field that is extended by two other classes; polarField and metricField. I want to store instances of these objects in a list, but at compile time I do not know if the list will contain polarFields or metricFields so I'm initilising the lists something like this:
1 2 3 4 5
Field* list;
if(x)
list = new polarMap[capacity];
else
list = new metricMap[capacity];
However, when I print out the elements from the list, a lot of them seem to be corrupted and if I have to expand the size of the list then the contents are completely lost.