#include #include #include using namespace std; class person { protected: string fname, lname, address, phone; public: person(string f, string l, string a, string p); void relocate(string newa, string newp); virtual void print(); }; person::person(string f, string l, string a, string p): fname(f), lname(l), address(a), phone(p) { } void person::relocate(string newa, string newp) { address = newa; phone = newp; } void person::print() { cout << fname << " " << lname << ", of " << address << ", phone " << phone; } class employee: public person { protected: double salary; string position; public: employee(string f, string l, string a, string p, double sal, string pos); virtual void print(); }; void employee::print() { person::print(); cout << "\n position=" << position << ", $" << salary; } employee::employee(string f, string l, string a, string p, double sal, string pos): person(f, l, a, p), salary(sal), position(pos) { } int main() { vector A; A.push_back(new person("Lavinia", "Leopard", "55 Frog St.", "4046662233")); A.push_back(new person("Jim", "James", "987 Horse Rd.", "7364536475")); A.push_back(new person("Joe", "Jones", "123 Cat St.", "3051112222")); A.push_back(new person("Jemimah", "Jones", "123 Cat St.", "3051112222")); A.push_back(new person("Jimmy", "Jones", "123 Cat St.", "3051234321")); A.push_back(new person("Jilly", "Jones", "123 Cat St.", "3053242315")); A.push_back(new person("Anathema", "Hamsoup", "234 Dog Av.", "3057651243")); A.push_back(new employee("Colin", "Nostril", "234 Dog Av.", "9765432124", 34500, "manager")); A.push_back(new employee("Evangelina", "Smith", "17 Ant St.", "7253981256", 64250, "designer")); A.push_back(new employee("Lumpy", "Morris", "550 Bee St.", "7352749812", 52000, "secretary")); A.push_back(new employee("Ravioli", "Johnson", "99 Bat St.", "6364858272", 57500, "typist")); for (int i = 0; i < A.size(); i += 1) { cout << i << ": "; A[i]->print(); cout << "\n"; } }