home *** CD-ROM | disk | FTP | other *** search
- // Chap27_3.cpp
- #include <iostream.h>
- class Furniture
- {
- public:
- Furniture()
- {
- }
- int weight;
- };
- class Bed : virtual public Furniture
- {
- public:
- Bed()
- {
- }
- void sleep()
- {
- }
- };
- class Sofa : virtual public Furniture
- {
- public:
- Sofa()
- {
- }
- void watchTV()
- {
- }
- };
- class SleeperSofa : public Bed, public Sofa
- {
- public:
- SleeperSofa() : Sofa(), Bed()
- {
- }
- void foldOut()
- {
- }
- };
-
- void fn()
- {
- SleeperSofa ss;
- cout << "weight = "
- << ss.weight
- << "\n";
- }
-
- int main()
- {
- fn();
- return 0;
- }
-