#include <iostream> using namespace std; class Furniture { public: Furniture(){} void SetWeight(unsigned i) { weight = i; } unsigned GetWeight() { return weight; } protected: unsigned weight; }; class Bed : virtual public Furniture { public: Bed(){} void Sleep() { cout<<"sleeping..."<<endl; } }; class Sofa : virtual public Furniture { public: Sofa(){} void WatchTV() { cout<<"watching TV..."<<endl; } }; class SleepSofa : public Bed, public Sofa { public: SleepSofa(){} void FoldOut() { cout<<"Fold out the sofa."<<endl; } }; int main() { SleepSofa ss; ss.WatchTV(); ss.FoldOut(); ss.Sleep(); ss.SetWeight(20); cout<<ss.GetWeight()<<endl; return 0; }