Using C++
Inheritance: Example Exercise
Suppose you are developing a program that a car dealership can use to manage its inventory. Create a class called "Automobile" which holds the following data members:
- Make Year/model (two pieces of information, but stored as one string)
- Mileage
- Price
Cars are given a "doors" member variable (2 or 4). Trucks are given a "drive" member variable (2-wheel, 4-wheel, all-wheel). Vans are given a "passenger capacity" variable.
Write an automobile base class with Cars, Trucks, and Vans as child classes, complete with parameterized constructors which pass the parent's member variables to the child class.