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

正文內(nèi)容

運(yùn)算符的重載(編輯修改稿)

2024-09-01 20:39 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 其他用途,只是用于區(qū)分前置運(yùn)算與后置運(yùn)算。 ? 例: 成員函數(shù)重載示例 。 include class Increase{ public: Increase(int x):value(x){} Increase amp。 operator++()。 //前增量 Increase operator++(int)。 //后增量 void display(){ cout the value is value endl。 } private: int value。 }。 Increase amp。 Increase::operator++() { value++。 //先增量 return *this。 //再返回原對(duì)象 } Increase Increase::operator++(int) { Increase temp(*this)。 //臨時(shí)對(duì)象存放原有對(duì)象值 value++。 //原有對(duì)象增量修改 return temp。 //返回原有對(duì)象值 } void main() { Increase n(20)。 ()。 (n++).display()。 //顯示臨時(shí)對(duì)象值 ()。 //顯示原有對(duì)象 ++n。 ()。 ++(++n)。 ()。 (n++)++。 //第二次增量操作對(duì)臨時(shí)對(duì)象進(jìn)行 ()。 } 此程序的運(yùn)行結(jié)果為: the value is 20 the value is 20 the value is 21 the value is 22 the value is 24 the value is 25 ? 例: 友元函數(shù)重載示例 。 include class Increase{ public: Increase(int x):value(x){} friend Increase amp。 operator++(Increase amp。 )。 //前增量 friend Increase operator++(Increase amp。,int)。 //后增量 void display(){ cout the value is value endl。 } private: int value。 }。 Increase amp。 operator++(Increase amp。 a) { ++。 //前增量 return a。 //再返回原對(duì)象 } Increase operator++(Increaseamp。 a, int) { Increase temp(a)。 //通過(guò)拷貝構(gòu)造函數(shù)保存原有對(duì)象值 ++。 //原有對(duì)象增量修改 return temp。 //返回原有對(duì)象值 } void main() { Increase n(20)。 ()。
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1