📄 test3.1_inherittestone.cpp
字号:
/*#include<iostream>
using namespace std;
class building
{
protected:
int floors,rooms,square;
public:
building(int floors,int rooms,int square)
{
this->floors=floors;
this->rooms=rooms;
this->square=square;
}
void showBuilding()
{
cout<<"Building:"<<"floors="<<floors<<",rooms="<<rooms<<",square"<<square<<endl;
}
};
class house:public building
{
private:
int bedroom,bathroom;
public:
house(int floors,int rooms,int square,int bedroom,int bathroom):building(floors,rooms,square)
{
this->bedroom=bedroom;
this->bathroom=bathroom;
}
void showHouse()
{
cout<<"House: "<<"floors="<<floors<<",rooms="<<rooms<<",square"<<square<<",bedroom="<<bedroom
<<",bathroom="<<bathroom<<endl;
}
};
class office:public building
{
private:
int fire_extinguisher,telephone;
public:
office(int floors,int rooms,int square,int fire_extinguisher,int telephone):
building(floors,rooms,square)
{
this->fire_extinguisher=fire_extinguisher;
this->telephone=telephone;
}
void showOffice()
{
cout<<"Office: "<<"floors="<<floors<<",rooms="<<rooms<<",square"<<square
<<",fire_extinguisher="<<fire_extinguisher<<",telephone="<<telephone<<endl;
}
};
void main()
{
building build(1,2,3);
build.showBuilding();
house hou(2,3,4,5,6);
hou.showHouse();
office off(3,4,5,6,7);
off.showOffice();
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -