// - - f1007
// 什么什么什么鸟?
//
#include <iostream>
using namespace std;
// =.-||、
class furniture
{
protected:
int weight;
public:
furniture():weight(0){}
void setweight(int i) {weight =i;}
int getweight() const {return weight;}
};
//==================================================
class bed:public furniture
{
public:
bed(){}
void sleep()const{cout<<"Sleeping...\n";}
};
//=================================================
class sofa:public furniture
{
public:
sofa(){}
void watchtv()const{cout<<"watching tv.\n";}
};
//================================================
class sleepersofa :public bed,public sofa
{
public:
sleepersofa():sofa(),bed(){}
void foldout()const
{cout<<"fold out the sofa.\n";}
};
//=============================================
int main()
{
sleepersofa ss;
ss.setweight(20); //!!!!这错
furniture *pf =(furniture *)&&ss; //!!!这错
cout<<pf->getweight()<<endl;
// - -
return 1;
}
// 什么什么什么鸟?
//
#include <iostream>
using namespace std;
// =.-||、
class furniture
{
protected:
int weight;
public:
furniture():weight(0){}
void setweight(int i) {weight =i;}
int getweight() const {return weight;}
};
//==================================================
class bed:public furniture
{
public:
bed(){}
void sleep()const{cout<<"Sleeping...\n";}
};
//=================================================
class sofa:public furniture
{
public:
sofa(){}
void watchtv()const{cout<<"watching tv.\n";}
};
//================================================
class sleepersofa :public bed,public sofa
{
public:
sleepersofa():sofa(),bed(){}
void foldout()const
{cout<<"fold out the sofa.\n";}
};
//=============================================
int main()
{
sleepersofa ss;
ss.setweight(20); //!!!!这错
furniture *pf =(furniture *)&&ss; //!!!这错
cout<<pf->getweight()<<endl;
// - -
return 1;
}
