您好,登錄后才能下訂單哦!
void print(int a,int b,int =0){
cout<<"執(zhí)行三個(gè)參數(shù)的"<<endl;
}
void print(int a,int b){
cout<<"執(zhí)行兩個(gè)參數(shù)的"<<endl;
}
//以上兩個(gè),在使用函數(shù)print(3,5);//error:ambiguous call to overloaded function
void print(int a){//注意返回類型
cout<<"ni"<<endl;
}
int print(int a){
return a;
}
void main(){
int a=3;
//print(8);注意函數(shù)返回類型不是函數(shù)重載的判斷標(biāo)準(zhǔn)。所以報(bào)錯(cuò):redefinition
const int f=4;
//int &g=f;不可把常量賦給int型引用
//int &c=3;不可把常量賦給int型引用
int &b=a;
const int &d=3;//可以給常量引用賦以常量。
const int &e=a;
a++;//a可以修改
//e++;但是定義為常量引用的e就不可以修改。
return ;
}
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。