Question: Objective: Developing a simple class, using vector and console input/output. We want to write a program for a phone calling list. Step 1. Develop a
Objective: Developing a simple class, using vector and console input/output.
We want to write a program for a phone calling list. Step 1. Develop a class name CallingList (CallingList.hpp, CallingList.cpp) inside the namespace phone.
CallingList class will have the following public methods:
CallingList(); o Constructor by default. It will create an empty calling list.
CallingList(const CallingList& orig); o Copy Constructor. It will create a calling list as a copy of the parameter.
~CallingList(); o Destructor.
void add(string name, string phone); o It adds a pair name/phone into the calling list. If the phone number was in the calling list,
name will be updated instead of inserting a new one.
vector
string getName(string phone) const; o It returns the name associated to a phone number.
void printList() const; o It prints the phone calling list.
void remove(string phone); o It removes an entry from the calling list searching by the phone number.
And it will use this private data definition: struct Person {
string name; string phone;
}; vectorlist;
#include
#include "CallingList.hpp"
using namespace std; using namespace Phone;
void Pause(); char Menu(); bool Confirm();
int main(int argc,char** argv) { char option; bool exit = false; CallingList callingList; string name, phone; vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
