// inherit10.h By: Aiman Hanna - ©1993-2006 Aiman Hanna #ifndef INHERIT10_H #define INHERIT10_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(); virtual void showInfo(); // Notice the difference here from inherit7.h 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(); virtual void showInfo(); // This is not really needed; it is already virtual from its parent class ~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