#include#include#includeusing namespace::std;
class Vehicle
{
public:
Vehicle();
int weight;
Vehicle(int WEIGHT) {
weight = WEIGHT;
};
void setWeight(int);
};
void Vehicle::setWeight(int WEIGHT)
{
weight = WEIGHT;
}
Vehicle::Vehicle(){}
class Car :virtual public Vehicle
{
public:
Car();
int aird;
Car(int WEIGHT, int AIRD) :Vehicle(WEIGHT) {
aird = AIRD;
};
void setAird(int);
};
Car::Car(){}
void Car::setAird(int AIRD)
{
aird = AIRD;
}
class Boat:virtual public Vehicle
{
public:
Boat();
double tonnage;
Boat(int WEIGHT, double TONNAGE) :Vehicle(WEIGHT) { tonnage = TONNAGE; };
void setTonnage(double);
};
Boat::Boat() {}
void Boat::setTonnage(double TONNAGE)
{
tonnage = TONNAGE;
}
class AmphibianCar :public Car, public Boat
{
public:
AmphibianCar();
AmphibianCar(int WEIGHT, int AIRD, double TONNAGE) :Vehicle(WEIGHT), Car(WEIGHT, AIRD), Boat(WEIGHT, TONNAGE) {};
void display1() {
cout<< "init Vehicle"<< endl;
cout<< "init car"<< endl;
cout<< "init Boat"<>WEIGHT >>AIRD >>TONNAGE;
cin >>WEIGHT1 >>AIRD1 >>TONNAGE1;
AmphibianCar Car1(WEIGHT, AIRD, TONNAGE);
Car1.display1();
Car1.setWeight(WEIGHT1);
Car1.setAird(AIRD1);
Car1.setTonnage(TONNAGE1);
Car1.display2();
return 0;
}
學(xué)院的題目,感覺還是挺簡(jiǎn)單的,但總感覺我的實(shí)現(xiàn)思路不像是學(xué)院要求的思路。大概跟上一題差不太多,但是我不懂輸出reset是為了干什么。題目是水陸兩用汽車類。
10年的新化網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整新化建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“新化網(wǎng)站設(shè)計(jì)”,“新化網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧