|
|
Employee employee("Tarik", "Neaj");employee.getname(); // I suggest changing name to getName (big N). Employee(string firstName, string lastName) :firstName(firstName), lastName(lastName){} |
|
Employee() {}
|
|
|
|
Name a std::vector<std::string> That way you can accommodate multiple middle names, amongst other things. For example, some cultures write their family name first.Name could be a class of it's own, and a variable of that type could be a member of the Person class.| andywestken wrote: |
|---|
| People are not employees of their manager... |
| TarikNeaj wrote: |
|---|
| It can be confusing in the beginning but you'll get the hang of it (in other words, its gonna get 10 times harder, be ready). |
|
|
| make parameters const pass by reference for anything that is a class no need to disambiguate with this->, when referring to members, already fixed by renaming parameter |
using namespace std; isn't good, so I have put std:: before each std thing, Google to see why that is.| In constructor 'Employee::Employee(std::string, std::string, std::string, std::string, std::string, Manager*)': 16:23: warning: 'Employee::lastName' will be initialized after [-Wreorder] 15:25: warning: 'std::string Employee::phoneNumber' [-Wreorder] 21:5: warning: when initialized here [-Wreorder] 15:25: warning: 'Employee::phoneNumber' will be initialized after [-Wreorder] 15:16: warning: 'std::string Employee::address' [-Wreorder] 21:5: warning: when initialized here [-Wreorder] 15:16: warning: 'Employee::address' will be initialized after [-Wreorder] 15:12: warning: 'std::string Employee::id' [-Wreorder] 21:5: warning: when initialized here [-Wreorder] 15:12: warning: 'Employee::id' will be initialized after [-Wreorder] 13:14: warning: 'Manager* Employee::manager1' [-Wreorder] 21:5: warning: when initialized here [-Wreorder] |
|
|
|
|
| My prof ended up saying my vector wasn't really doing anything which I didn't understand why it wasn't. |
emplace_back to construct an employee in place, rather than creating a new object like you do on line 48. The addEmployee function shouldn't do any printing.