I have main class called Employee
, where I have two subclasses PermanentEmployee
and ContractedEmployee
. I have to store both these types of objects in a same unordered_map<Employee>
.
Then when I am trying to get them back from the map, both the types are automatically upcasted to the base type, Employee
, and the attributes of subclass are gone !
Are there any method to stop automatically upcasting those objects ?
Or are there any method to retrieve those attributes back ?
Aucun commentaire:
Enregistrer un commentaire