public :
Bed( ) { }
void sleep( ) { cout << "Спим" << endl ; }
int weight ;
} ;
class Sofa
{
public :
Sofa( ) { }
void watchTV( ) { cout << "Смотрим телевизор" << endl ; }
int weight ;
} ;
/* SleeperSofa — диван-кровать */
class SleeperSofa : public Bed , public Sofa
{
public :
SleeperSofa( ) { }
void foldOut( ) { cout << "Раскладываем диван-кровать"
<< endl ; }
} ;
int main( int nNumberofArgs , char* pszArgs[ ] )
{
/* печать кириллицы, если Вы не установите программки gccrus.exe и g++rus.exe */
setlocale ( LC_ALL , ".1251" ) ;
SleeperSofa ss ;
/* Посмотрим телевизор на диване... */
ss.watchTV( ) ; /* Sofa::watchTV( ) */
/* ...разложим его в кровать... */
ss.foldOut( ) ; /* SleeperSofa::foldOut( ) */
/* ...и ляжем спать */