Question: In C++, create a base case named Vehicle that has the odometer reading. Class Vehicle requires its inheritance to override its member function print .
In C++, create a base case named Vehicle that has the odometer reading. Class Vehicle requires its inheritance to override its member function print. Derive from Vehicle classes Car and Truck. Classes Carand Truck member function print is to output their type and odometer reading (eg. Truck at 23000 miles). Show a main function that declares of an array of 100 pointers to Vehicle, calls the inventory function to initialize the array, prints the inventory while adding 100 miles to each of the vehicle's odometer reading.
Given: int inventory(Vehicle * v[], int maxsize); //returns the actual number of vehicles initialized
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
