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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started