Question: In c++: class Contact (abstract class) Private member data: a pointer to a Contact object (which can be an EmployeeContact or ContractorContact) called next -
In c++:
class Contact (abstract class)
- Private member data: a pointer to a Contact object (which can be an EmployeeContact or ContractorContact) called next - this is the link to the next node in a Contact List.
- Protected member data: name (a Name object), business phone (string in the form "1-408-222-8888"), email (jamesw@tpcommunications.com), location (a number for cubical location say 4, 10, 20, ...).
- Public static data (constant): default values for name, business phone, email and location to be used by default constructor.
- Constructors:
- Default constructor: note that name is an object inside another object (composition). Make sure you use the right syntax to initialize it. Set member data to default values specified by static data (don't forget to initialize the "next" link).
- Non-default constructor: take 5 parameters first name, last name, phone, email, location. Don't forget to initialize the next field.
- Destructor: must be declared as virtual destructor. Output ("
has gone home ..."). - Public member functions:
- accessors/mutators for all member data including the next pointer.
- ShowContact: a pure virtual function (no implementation is required) which will be defined later by its derived classes. It should return void, take no parameter and be declared as constant function.
ps. EmployeeContact and ContractorContact are two derived classes from class Contact
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
