home *** CD-ROM | disk | FTP | other *** search
- // Chap27_2.cpp
- #include <iostream.h>
-
- //Furniture - more fundamental concept; this class
- // has "weight" as a property
- class Furniture
- {
- public:
- Furniture()
- {
- }
- int weight;
- };
-
- class Bed : public Furniture
- {
- public:
- Bed()
- {
- }
- sleep()
- {
- }
- };
- class Sofa : public Furniture
- {
- public:
- Sofa()
- {
- }
- void watchTV()
- {
- }
- };
- class SleeperSofa : public Bed, public Sofa
- {
- public:
- SleeperSofa()
- {
- }
- void foldOut()
- {
- }
- };
-
- void fn()
- {
- SleeperSofa ss;
- cout << "weight = "
- << ss.weight //problem solved; right?
- << "\n";
- }
-
- int main()
- {
- fn();
- return 0;
- }
-