Question: Inheritance 1. Make a class Vehicle with a member function to set the gas mileage, which is stored in a data member 2. Add member

 Inheritance 1. Make a class Vehicle with a member function to

Inheritance 1. Make a class Vehicle with a member function to set the gas mileage, which is stored in a data member 2. Add member function display to write on the screen the vehicle's gas mileage 3. Make a class Car which inherits from Vehicle 4. Add a member function to Car to set the maximum number of passengers, which is stored in a data member 5. Add member function display to Car which writes the number of passengers on the screen and the gas mileage by using the base class display function 6. Make a class Truck which inherits from Vehicle 7. Add a member function to Truck to set the maximum payload, which is stored in a data member 8. Add member function display to Truck which writes the payload on the screen and the gas mileage by using the base class display function 9. Use the following main function to obtain the given output include "PP86Inheritance.h" int main() Car sedan; Truck bigRig; sedan.setMileage (25); sedan.setPassengers (5): sedan.display(); cout

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!