43 lines
950 B
C++
43 lines
950 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 of unique people so set is usefull enough
|
|
|
|
} ;
|
|
|
|
#endif
|