Question 3:
Define the SUV class for testing virtual base classes as follow:
class SUV : public PassCar, public Van
{
private:
//
public:
SUV(...) : Car(...)
{
// Initialize additional data members
}
void display() const
{
PassCar::display();
Van::display();
// Output additional data members
}
};
3.1) Change the definition of the PassCar class in the car.h header file to make Car a
virtual base class of the PassCar class.
3.2) Then define the Van class using the Car class as a virtual base class. The new class
should contain an additional data member used to represent the payload of the van in
kilograms. A maximum of 750 kg applies to vans. The constructor should use default
values to initialize the data members with defaults, thus providing a default
constructor for the class. A maximum value of 750 applies for the payload. In addition
to the access method display(), you still need to define methods for screen output.
Create the class SUV, which is derived from PassCar and Van, to represent a station
wagon. Store the number of seats available in the station wagon as a data member.
The constructor in the SUV class should use the base initializer to set all the values of
a station wagon using default values for every data member. Additionally, define
access methods and a display() to define output.
3.3)
3.4) Use a main function to test the SUV class; the function should create station wagons
with and without default values and display them on screen.