2022-11-30

#include<iostream>

using namespace std;

class car;

class boat[

private:

int weight;

public:

boat(int weight)

(this->weight=weight;

friend int gettotalweight(boat &b,car &c);

class carf

private:

int weight;

public:

car(int weight)

this->weight=weight;

friend int gettotalweight(boat &b,car &c);

int gettotalweight(boat &b,car &c)

(return b.weight+c.weight;

int main()

boat b(3);

car c(2);

cout<<"總重量是:"<<gettotalweight(b,c)<<endl;

return 0;

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • #include using namespace std; class Time { protected: int...
    挽風(fēng)不能死閱讀 206評論 0 0
  • 登臨(七律) 憂患千載處涸轍, 五星隱耀傅長歌。 江山亙古歸籬落, 盛世將傾振#include using nam...
    挽風(fēng)不能死閱讀 210評論 0 0
  • 不支持上傳文件,所以就復(fù)制過來了。作者信息什么的都沒刪。對前端基本屬于一竅不通,所以沒有任何修改,反正用著沒問題就...
    全棧在路上閱讀 2,061評論 0 2
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,841評論 0 10
  • SwiftDate概況 從Swift發(fā)布起,我們就沒有放棄使用Swift。 當(dāng)然,我們希望在項目能夠輕松自如地管理...
    Mee_Leo閱讀 10,333評論 1 13

友情鏈接更多精彩內(nèi)容