Class hierarchy and inheritance c++

  c++, class, hierarchy, inheritance, oop

I have 3 classes: Company, Employee and Manager. Company has a name and a vector/pointer to a "list" of its employees. Employee has a name, salary, employment date and an id. Manager inherits from Employee, but it has a vector of employees that work for him.
Is there a way I can store objects of type Employee and Manager in a single data structure in Company class?
If not, I tried to make a vector in Company and to add a Boolean that says if the Employee is a manager too. However, in this case, I’m not sure how to acces the list of employees of an Manager because the vector has only Employees.
Any advice?

Source: Windows Questions C++

LEAVE A COMMENT