Question: My c++ question is on the second and third classes. Can you give me some examples of showContact Object in these two Derived classes, thankyou

My c++ question is on the second and third classes. Can you give me some examples of showContact Object in these two Derived classes, thankyou

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.

class EmployeeContact (derived from Contact)

  • Private member data: title and department.
  • Public static data (constant): default values for title and department to be used by default constructor.
  • Constructors
    • Default constructor: Must explicitly invoke base class default constructor.
    • Non-default constructor: takes 7 parameters: 5 required by the base class constructor and 2 required by itself. Perform initialization similar to default constructor.
  • Destructor: explicitly declared as virtual (no-op).
  • Public member functions:
    • accessor/mutator for both member data.
    • ShowContact: must be explicitly declared it as virtual and nicely format the data as seen below:

James West Software Engineer Engineering Room 23 1-408-790-8251 jamesw@tpcommunications.com

class ContractorContact (derived from Contact)

  • Private member data: company and assignment duration (months).
  • Public static data (constant): default values for company and assignment duration to be used by default constructor.
  • Constructor
    • Default constructor: Must explicitly invoke base class default constructor.
    • Non-default constructor: takes 7 parameters. You must know what to do here.
  • Destructor: explicitly declared as virtual (no-op).
  • Public member functions:
    • accessor/mutator to both member data.
    • ShowContact: must be explicitly declared it as virtual and nicely format the data as seen below:

Cindy Lincoln 6 months (contractor) TK Consultings Room 9 1-408-790-7372 cindyl@tpcommunications.com

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!