Question: Create a class called Person. Class Person has one private member variable, string name. Class Person has a parametrized constructor that accepts the argument for

Create a class called Person. Class Person has one private member variable, string name. Class Person has a parametrized constructor that accepts the argument for name and sets the value of the member variable name. Class Person has one accessor member function getname() that return the value of name. Class Mechanic inherits from class Person. Class Mechanic has one private member variable, string expertise. Class Mechanic has a parametrized constructor that accepts the arguments for name and expertise and passes name to the base class constructor and sets the value of member variable expertise. Class Mechanic has one public member function getexpertise() that returns the description of the member variable expertise. Class Customer inherits from class Person and has two private member variables, string car that holds the make, model and year of the car in a single string and a pointer to class Mechanic *mptr. It has a parametrized constructor that accepts arguments for name, car and mptr and passes name to base class constructor and sets the values of member variables car and mptr. Class Customer has a public member function getcar() that returns the value of member variable car and another public member function getmechanic() that returns the name of the mechanic for that customer. In a client program, create two Mechanic objects and three customer objects. Display the customers name, make, model, year of the customers car and the name of that customers mechanic. Also, separately display the name of each mechanic and his/her expertise. Note: You must pass the address of one of the Mechanic object to the Customer objects mptr member variable to assign that mechanic to that customer

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!