// inherit7.h By: Aiman Hanna - ©1993-2006 Aiman Hanna #ifndef INHERIT7_H #define INHERIT7_H #include #include class Vehicle { public: Vehicle(double pr = 0, int ms = 0); // Now, this is a default constructor void setPrice(double); double getPrice(); void setMaxSpeed(int); int getMaxSpeed(); void showInfo(); protected: double price; int maxSpeed; }; // Derived classes from Vehicle class Bus : public Vehicle { public: Bus(); Bus(double, int, double); void setCargoCapacity(double); double getCargoCapacity(); void showInfo(); private: double cargoCapacity; }; class Car : public Vehicle { public: Car(double pr = 0, int ms = 0, char* md = "Not Yet Known"); // Now, this is a default constructor void setModel(char*); char* getModel(); void showInfo(); ~Car(); protected: char* model; }; // Just a simple enum type enum toptype {hardtop, softtop}; // Derived classes from Car, which is derived from Vehicle class Convertible : public Car { public: Convertible(); Convertible(double, int, char*, toptype); void setTopType(toptype); char* getTopType(); void showInfo(); private: toptype top; }; #endif