1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
#include "stdafx.h"
#include <iostream>
#include "emp.h"
abstr_emp::abstr_emp()
{
fname = "no fname";
lname = "no lname";
job = "no job";
}
abstr_emp::abstr_emp(const std::string & fn, const std::string & ln,
const std::string & j)
{
fname = fn;
lname = ln;
job = j;
}
void abstr_emp::ShowAll() const
{
std::cout << "First name: " << fname << std::endl;
std::cout << "Last name: " << lname << std::endl;
std::cout << "Job: " << job << std::endl;
}
void abstr_emp::SetAll()
{
std::cout << "Fname: ";
std::cin >> fname;
std::cout << "Lname: ";
std::cin >> lname;
std::cout << "Job: ";
std::cin >> job;
}
std::ostream & operator<<(std::ostream & os, const abstr_emp & e)
{
os << e.fname << e.lname;
return os;
}
employee::employee() : abstr_emp("no fname", "no lname", "employee")
{ }
employee::employee(const std::string & fn, const std::string & ln,
const std::string & j) : abstr_emp(fn, ln, j)
{ }
void employee::ShowAll() const
{ abstr_emp::ShowAll(); }
void employee::SetAll()
{ abstr_emp::SetAll(); }
manager::manager() : abstr_emp()
{
inchargeof = 0;
}
manager::manager(const std::string & fn, const std::string & ln,
const std::string & j, int ico) : abstr_emp(fn, ln, j)
{
inchargeof = ico;
}
manager::manager(const abstr_emp & e, int ico) : abstr_emp(e)
{
inchargeof = ico;
}
manager::manager(const manager & m)
{
*this = m;
}
void manager::ShowAll() const
{
abstr_emp::ShowAll();
std::cout << "In charge of " << inchargeof << " people" << std::endl;
}
void manager::SetAll()
{
abstr_emp::SetAll();
std::cout << "In charge of: ";
std::cin >> inchargeof;
}
fink::fink() : abstr_emp()
{
reportsto = "no one";
}
fink::fink(const std::string & fn, const std::string & ln,
const std::string & j, const std::string & rpo)
: abstr_emp(fn, ln, j)
{
reportsto = rpo;
}
fink::fink(const abstr_emp & e, const std::string & rpo)
: abstr_emp(e)
{
reportsto = rpo;
}
fink::fink(const fink & e)
{
*this = e;
}
void fink::ShowAll() const
{
abstr_emp::ShowAll();
std::cout << "Reports to: " << reportsto << std::endl;
}
void fink::SetAll()
{
abstr_emp::SetAll();
std::cout << "Reports to: ";
std::cin >> reportsto;
}
highfink::highfink()
{ }
highfink::highfink(const std::string & fn, const std::string & ln,
const std::string & j, const std::string & rpo,
int ico)
: manager(fn, ln, j, ico), fink(fn, ln, j, rpo), abstr_emp(fn, ln, j)
{ }
highfink::highfink(const abstr_emp & e, const std::string & rpo, int ico)
: manager(e, ico), fink(e, rpo), abstr_emp(e)
{ }
highfink::highfink(const fink & f, int ico) : fink(f), abstr_emp(f), manager(f, ico)
{ }
highfink::highfink(const manager & m, const std::string & rpo)
: manager(m), fink(m, rpo), abstr_emp(m)
{ }
highfink::highfink(const highfink & h)
{
*this = h;
}
void highfink::ShowAll() const
{
manager::ShowAll();
std::cout << "Reports to: " << ReportsTo() << std::endl;
}
void highfink::SetAll()
{
abstr_emp::SetAll();
manager::SetAll(); // This part may also not work, but probably not
fink::SetAll(); // the cause of errors
}
|