I am trying to create a extensive database for a company. I have made different classes for every level of employee. But i don't understand how do i push different type objects in a single map.
As far as i have tried it just gets pushed, shows no compilation error as for now atleast.
class EmployeeClass
{}
class CEOClass: public EmployeeClass
{}
class ManagerClass:public EmployeeClass
{}
class EngineerClass: public EmployeeClass
{}
int main()
{
EngineerClass engineerClassObject;
std::map<std::string employeeName, EmployeeClass> employeeMap;
employeeMap.insert({employeeName, enginerrClassObject});
}
I want to understand if i can do this. If not what is the best way of doing this without adding extra maps. If yes how is possible and how does it work?