#ifndef TRUCK_H #define TRUCK_H #include "Automobile.h" using namespace std; // The Truck class represents a truck. class Truck : public Automobile { private: string driveType; string cabType; public: // Default constructor Truck() : Automobile() { driveType = "2WD"; cabType = "Regular"; } // Constructor #2 Truck(string truckMake, int truckModel, int truckMileage, double truckPrice, string truckDriveType, string truckCabType) : Automobile(truckMake, truckModel, truckMileage, truckPrice) { driveType = truckDriveType; cabType = truckCabType; } //destructor is meaningless in this example but provided to illustrate the flow of control ~Truck() {} // Accessors string getDriveType() const { return driveType; } string getCabType() const { return cabType; } //void displayVehicleInfo() virtual void displayVehicleInfo() const { cout << fixed << showpoint << setprecision(2); cout << "Model year " << model << endl; cout << "Make " << make << endl; cout << "Mileage " << mileage << " miles " << endl; cout << "Price: $" << price << endl; cout << "Drive type " << driveType << endl; cout << "Cab type is " << cabType << endl; } }; #endif // TRUCK_H