[英]C++, overloading functions with array, as default
Hey i was looking for some silly help i am starting with c++ in my studies, wanted my program for my professor to look better but. 嘿,我在寻找一些愚蠢的帮助,我在学习中从C ++开始,希望我的教授的程序看起来更好,但是。
I am stuck at overloading functions with array as default parameter.. 我陷入重载函数与数组作为默认参数。
using namespace std;
int kol[8]={0};
void zad(int a){
zad(a,*b[]);
// this is bad overload don't know how
// need to couple to void zad(int a,int b[]=kol)..
}
void zad(int a,int b[]=kol){
// do know is this correct code block didn't say anything
}
void zad(int a,int b[]=kol){
// do know is this correct code block didn't say anything
}
is not valid syntax. 是无效的语法。 You can only say
arg=literal
for default arg decalrarions. 对于默认的arg十进制,只能说
arg=literal
。 Do 做
void zad(int a,int b[]){
// do know is this correct code block didn't say anything
}
void zad(int a){
zad(a, zol);
}
ie create an overload with the full param list and call it with the args you want to pass; 例如,使用完整的参数列表创建一个重载,并使用您要传递的args进行调用;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.