望一键三连!
#include <iostream>
#include <string>
using namespace std;
class building
{
private:
int floor;
unsigned short history;
string name;
double area;
public:
building()
{
floor=0;
history=0;
name="";
area=0.0;
}
building(string n):
name(n) {}
building(int f,unsigned short h,string n,double a):
floor(f),history(h),name(n),area(a) {}
void SetFloor(building&bd)
{
cin>>bd.floor;
}
void SetHistory(building&bd)
{
cin>>bd.history;
}
void SetArea(building&bd)
{
cin>>bd.area;
}
void SetName(building&bd)
{
cin>>bd.name;
}
void SetFloor1(int f)
{
floor=f;
}
void SetHistory1(unsigned short h)
{
history=h;
}
void SetArea1(double a)
{
area=a;
}
void SetName1(string n)
{
name=n;
}
int GetFloor(building&bd)
{
return bd.floor;
}
unsigned short GetHistory(building&bd)
{
return bd.history;
}
string GetName(building&bd)
{
return bd.name;
}
double GetArea(building&bd)
{
return bd.area;
}
};
class BuildingPlan:public building
{
private:
unsigned int day;
string NameOfA;
string NameOfB;
public:
BuildingPlan()
{
SetFloor1(0);
SetName1("");
SetHistory1(0);
day=0;
NameOfA="";
NameOfB="";
}
BuildingPlan(int f,string n,unsigned short h,double area,int d,string a,string b):
day(d),NameOfA(a),NameOfB(b)
{
SetFloor1(f);
SetName1(n);
SetHistory1(h);
}
void SetDay(BuildingPlan&bd)
{
cin>>bd.day;
}
void SetNameOfA(BuildingPlan&bd)
{
cin>>bd.NameOfA;
}
void SetNameOfB(BuildingPlan&bd)
{
cin>>bd.NameOfB;
}
unsigned int GetDay(BuildingPlan&bd)
{
return bd.day;
}
string GetNameOfA(BuildingPlan&bd)
{
return bd.NameOfA;
}
string GetNameOfB(BuildingPlan&bd)
{
return bd.NameOfB;
}
};
int main()
{
building bd;
BuildingPlan bdp;
bd.SetFloor(bd);
bd.SetHistory(bd);
bd.SetName(bd);
bd.SetArea(bd);
return 0;
}