When using std::map in c++, is it possible to store inherited classes as their \"base class\" in the map and still being able to call their overloaded methods? See this exam
First idea is that to get polymorphism you need to call member method on pointer or reference. I would store pointer to base class in the map (the element that you store gets copied) and then call via pointer like this:
#include
#include
You get result "2".
Note: You have to take care of the allocated memory now.