I have a map of base class pointers and I need to apply a class function to the mapped data.
I am dealing with shapes the user will input and then has the opportunity to manipulate them (translate, rotate...). I have functions witch work that manipulate the shapes and the shapes are stored in a map.
I am struggling with how to access and manipulate the mapped shapes.
I have the following code;
polygon * T;
map<string, polygon*> shape_map;
new_shape = Trans + user_input; // adds Tranaslated to the key
cout << "ID " << new_shape << " = " << endl; // ouput the key witch also id's the shape
T = shape_map[user_input]->translate(matrix(Xtrans, Ytrans));
T->printshape();
When I run my code the program stops just before it should print the shape and when I debug it highlights a line in my translate function, but I'm confident that my translate function is fine as I have tested it before.
I think the problem is in how I am calling the functions but I'm not certain.
Any help would be great!