1
0
Fork 0
This repository has been archived on 2021-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
uni-m.cds-adv-prog/ex8.2/Manager.hh
Eric Teunis de Boone 78d6fb4e3c Finished Ex8.*
2020-01-06 19:07:30 +01:00

43 lines
933 B
C++

#ifndef MANAGER_HH
#define MANAGER_HH
#include <string>
#include <iostream>
#include <set>
#include "Employee.hh"
using namespace std ;
class Manager : public Employee {
public:
Manager(const char* name, double salary) : Employee(name, salary) {}
void businessCard( ostream& os = cout) const {
Employee::businessCard( os );
os << " +----------+ " << endl
<< " Subordinates " << endl
<< " +----------+ " << endl;
for ( auto iter = _subordinates.begin() ; iter != _subordinates.end(); iter++ ) {
os << " - " << (*iter)->name() << endl;
}
os << " +----------+ " << endl;
}
void addSubordinate ( Employee& empl ) {
_subordinates.insert( &empl );
}
const set<Employee*>& listOfSubordinates() const {
return _subordinates;
}
private:
string _name ;
double _salary ;
set<Employee*> _subordinates ;// subordinates is an unordered collection so set is usefull enough
} ;
#endif