• void display() const - a query that displays the phone number in CCC- AAA-LLLLLLL format, where CCC denotes country code, AAA denotes area code within a country or region and L[r]
(1)Part D – Inheritance Workshop 7 LEARNING OUTCOME
Upon successful completion of this workshop, you will have demonstrated the abilities to design
• use inheritance,
• call a base class constructor from the derived class constructor, and
• access a base class function that is shadowed by a derived class function Phone Number
Design and code a class named PhoneNumber that holds information for a telephone number Upon instantiation, a PhoneNumber object may receive an integer identifying the area code and an integer identifying the local telephone number If the object does not receive any number, or does not receive a valid number, the object adopts a safe empty state
Your PhoneNumber class includes the following member functions:
• void setAreaCode(int areaCode) – a modifier that set value for area code
• void setLocalNumber(int localNumber) – a modifier that set value for local telephone number
• void display() const - a query that displays the phone number in AAA-LLLLLLL format, where AAA denotes area code and LLLLLLL denotes local number
For the purpose of this workshop, you may assume that the user will input the data correctly
Derive from PhoneNumber a class named IntlPhoneNumber that holds information for an international number Upon instantiation, an IntlPhoneNumber object may receive an integer identifying the country or region code, an integer identifying the area code within the country or region and an integer identifying the local telephone number within the area code If the object does not receive any number, or does not receive a valid number, the object adopts a safe empty state
Your IntlPhoneNumber class includes the following member functions:
(2)• void setCountryCode(int countryCode) – a modifier that set value for country or region code
• void display() const - a query that displays the phone number in CCC-AAA-LLLLLLL format, where CCC denotes country code, AAA denotes area code within a country or region and LLLLLLL denotes local number
For the purpose of this workshop, you may assume that the user will input the data correctly
Write a C++ program to allow users to input information for up to 20 international telephone numbers If users enter -1 for country code, stop inputting data and display entered telephone numbers
The output from your program should look something like: