43 lines
933 B
C++
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
|