// inherit15.h By: Aiman Hanna - ©1993-2002 Aiman Hanna #ifndef INHERIT15_H #define INHERIT15_H #include enum avl_colors { red, black, white, green }; enum yes_no { yes, no }; class Vehicle { public: // Public: This part is seen by the whole outside world Vehicle( avl_colors clr = white, int cyl = 4 ); //Vehicle( avl_colors, int ); void ShowInfo( void ); protected: // Protected: This part is visible only to: // 1) that class, // 2) its friend classes & // 3) its inherited classes // Notice that there was no need to have these functions as public. // Notice that we could have numcyl & color as private and use initialization // lists to manipulate them when creating objects from the inherited // classes. (In fact, this could still be better, however we keep them here as // protected just to clarify the topic which we are exploring here). int GetNumCyl( void ); char* GetColor( void ); int numcyl; avl_colors color; }; class Bus: public Vehicle { public: Bus( avl_colors aclr = black, int cyl = 12, yes_no bar = no ); void ShowInfo( void ); yes_no HasBar ( void ); private: yes_no barexist; }; class Van: public Bus { public: Van( avl_colors aclr = white, int cyl = 6, yes_no tur = no ); void ShowInfo( void ); yes_no IsTurbo( void ); private: yes_no turbo; }; #endif