home *** CD-ROM | disk | FTP | other *** search
- // Chap27_1.cpp
- class Bed
- {
- public:
- Bed()
- {
- }
- void sleep()
- {
- }
- int weight;
- };
- class Sofa
- {
- public:
- Sofa()
- {
- }
- void watchTV()
- {
- }
- int weight;
- };
-
- //SleeperSofa - is both a Bed and a Sofa
- class SleeperSofa : public Bed, public Sofa
- {
- public:
- SleeperSofa()
- {
- }
- void foldOut()
- {
- }
- };
-
- int main()
- {
- SleeperSofa ss;
- //you can watch TV on a sleeper sofa...
- ss.watchTV(); //Sofa::watchTV()
- //...and then you can fold it out...
- ss.foldOut(); //SleeperSofa::foldOut()
- //...and sleep on it (sort of)
- ss.sleep(); //Bed::sleep()
- return 0;
- }
-