Lab 12
Problem 1: Create the following class hierarchy.
- Abstract Class
Contactthat contains a person's name. - Class
Friendderived fromContactthat contains the date of birth, phone number, and address. - Class
Acquaintancederived fromContactthat contains the phone number. - Class
Colleaguederived fromContactthat contains the phone number, the company they work for, and the address. - Class
AddressBookthat contains multiple elements of typeContact.
The AddressBook class has the following functions:
- A method to search for a contact by name.
- A method that returns a list of friends (contacts of type Friend).
- A method that deletes a specific contact by name.
- A method that adds a specific contact.
For creating the classes, UML techniques will be used.
For the contact type (Friend, Acquaintance, and Colleague), an enumeration will be defined (also using UML methods) to describe this type of data.
Also, create code in main.cpp to illustrate how these components work.