A class may have several constructors, for example:
class myClass {
//constructor 1
myClass(int nx,int ny, int size){ c = nx * ny;};
//constructor 2
myClass(int nx,int ny, int nz, int size){ c = nx * ny * nz;};
.
}
When you generate instances of myClass, you may use:
myClass d2,d3;
d2.myClass(nx,ny,c);
d3.myClass(nx,ny,nz,c);
or use
d2.myClass(nx,ny,c);
.
b = a / c;
d2.myClass(nx,ny,nz,c);
.
b = a / c;
the later 2 d2.myClass() are "function overload",
one with 3 parameters and another with 4 parameters
what is the mean of function ?
what is the mean of function ?
I want to know something about function in c++,and how to use it in programming !
especially in function overload!
help!
I want to know something about function in c++,and how to use it in programming !
especially in function overload!
help!
其他人氣:174 ℃時(shí)間:2020-02-04 07:21:25
優(yōu)質(zhì)解答
我來(lái)回答
類似推薦
- What's the mean of "What is it?
- What Is The Mean Of The Yonkers.
- what is the mean?what is the mean?what is the mean?what is the mean?
- What is the mean of " URL "
- what is the mean of TVC or CF
- 有"9v 3w"的燈泡1和"12v 6w"的燈泡2串聯(lián),電路中兩端允許加的最大電壓是多少?每個(gè)燈的電功率?
- 一罐液化氣大約有多少立方?
- 小池古詩(shī)的意思
- 一根電線,第一次用去1/3還多2米,第二次用去余下的2/5少3米,最后還剩11米.這根電線長(zhǎng)多少米?
- 原有蘋果21千克,葡萄13千克,這兩種水果被吃掉相同的重量之后,所剩葡萄的重量是所剩蘋果重量的十三之八
- 全班有51人,下課后男生走了4分之1,女生走了3分之1,人數(shù)相等,女生有幾人
- 關(guān)于x的不等式3m-2x2,m的值是什么
猜你喜歡
- 1書非借不能讀也的也怎么解釋
- 2我愛我們的節(jié)日——春節(jié)征文、急需、
- 3GB2828二次抽樣方案什么情況下適用
- 4賓語(yǔ)與表語(yǔ)兩個(gè)如何判斷?
- 5Hello!__is Lin Tao.Could you tell me if __is a history museum in your city?此句怎么寫
- 6四年級(jí)下冊(cè)14課《陳嘉庚辦學(xué)》讀后感.在今天(4月9日)16時(shí)10分發(fā)來(lái).(原文
- 7This is a _____ of my family.
- 8李奶奶家中有一筐雞蛋,2個(gè)2個(gè)的數(shù),3個(gè)3個(gè)的數(shù),5個(gè)5個(gè)的數(shù),都剩余一個(gè),這筐雞蛋至少有多少個(gè)?
- 9如圖所示,長(zhǎng)木板靜止在光滑的水平面上,長(zhǎng)木板的左端固定一個(gè)檔板,檔板上固定一個(gè)長(zhǎng)度為L(zhǎng)的輕質(zhì)彈簧,長(zhǎng)木板與檔板的總質(zhì)量為M,在木板的右端有一質(zhì)量為m的鐵塊.現(xiàn)給鐵塊一個(gè)水平
- 10一些孩子在操場(chǎng)上奔跑 翻譯
- 11一道比較難的集合題謝謝了,
- 12難忘的八個(gè)字 閱讀題答案!