#include #include #include using namespace std; void log(string event, string description) { /* let's pretend this makes an official record in a file somewhere */ } class person { protected: string fname, lname, addr, phone; public: person(string f, string l, string a, string p) { fname = f; lname = l; addr = a; phone = p; } void print() { cout << fname << " " << lname << " of " << addr << ", phone " << phone << "\n"; } string get_name() { return fname + " " + lname; } string get_address() { return addr; } string get_phone() { return phone; } void change_name(string f, string l) { log("name change from ", fname + " " + lname + " to " + f + " " + l); fname = f; lname = l; } void change_address(string a) { log("address change for ", fname + " " + lname + " to " + a); addr = a; } void change_phone(string p) { log("phone change for ", fname + " " + lname + " to " + p); phone = p; } }; int main() { vector database; database.push_back(new person("Joe", "Ant", "123 Cat St", "3059990001")); database.push_back(new person("Jenny", "Ant", "123 Cat St", "3059990001")); database.push_back(new person("Amy", "Bat", "987 Dog Ave", "7860106734")); database.push_back(new person("Fred", "Horse", "66 Main St", "5552679742")); database.push_back(new person("Betty", "Thing", "456 Dog Ave", "2010012694")); database[2]->change_name("Amy", "Horse"); for (int i = 0; i < database.size(); i += 1) database[i]->print(); }