Finding out the type of a polymoprphic type without using dynamic_cast