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

44 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