📄 e3.cpp
字号:
#include<iostream.h>
class Furniture
{
public:
Furniture(){}
void SetWeight(int i){weight=i;}
int GetWeight(){return weight;}
protected:
int weight;
};
class Bed:public Furniture
{
public:
Bed(){}
void Sleep()
{
cout<<"Sleep..."<<endl;
}
};
class Sofa:public Furniture
{
public:
Sofa(){}
void WatchTV()
{
cout<<"Watching TV."<<endl;
}
};
class SleepSofa:public Bed,public Sofa
{
public:
SleepSofa():Sofa(),Bed(){}
void FoldOut()
{
cout<<"Fold out the sofa."<<endl;
}
};
void main()
{
SleepSofa ss;
ss.SetWeight(20);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -