freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c上機實驗報告實驗六-閱讀頁

2025-05-28 18:23本頁面
  

【正文】 //使指針p指向bicycle類對象b pRun()。 p=amp。 //使指針p指向motorcar類對象c pRun()。 p=amp。 //使指針指向motorbicycle類對象d pRun()。 return 0。源程序:include iostreaminclude stringusing namespace std。 //構(gòu)造函數(shù) Birthday(){} //構(gòu)造函數(shù) ~Birthday(){} //析構(gòu)函數(shù) Birthday(Birthday amp。 //復(fù)制構(gòu)造函數(shù) int showBirthday(){ coutyear年month月day日。private: int year,month,day。Birthday::Birthday(Birthday amp。month=。}Birthday::Birthday(int Year,int Month,int Day) //Birthday類構(gòu)造函數(shù) { year=Year。 day=Day。 cinyearmonthday。p)。)。)。 int enter()。 //字符串類型變量數(shù)據(jù)成員 Birthday p1。int people::show(){ cout\n性別 sex 編號 。 cout 生日 。 //調(diào)用Birthday類成員函數(shù) cout 身份證號 idendl。 cout性別:。 cout編號:。 cout身份證號:。}people::people(people amp。 sex=。}people people::operator==(people amp。 } else {cout have different id!endl。U) //重載運算符成員函數(shù){ number=。 id=。 return *this。 people p[2]。t2。 p[t].enter()。t2。 p[t].show()。 //定義people類的對象p3 p3p[1]。 ()。 p[0]==p[1]。}運行結(jié)果:思考題1. 如何將一個運算符重載為類的成員函數(shù)?一般語法形式:返回類型 operator 運算符(形參表){函數(shù)體}函數(shù)的參數(shù)個數(shù)比原來的曹祖數(shù)個數(shù)要少一個(后置“++”,“”除外)。3. 如何實現(xiàn)運行時刻的多態(tài)?通過繼承和虛函數(shù)實現(xiàn)。如果未聲明為虛函數(shù),則普通的派生類的新成員函數(shù)會覆蓋基類同名成員函數(shù),將不能實現(xiàn)運行時刻多態(tài)
點擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1