函数的参数的默认值
2016-12-17 13:49
134 查看
A default argument shall not be redefined by a later declaration (not even to the same value)
#include<iostream>
using namespace std;
void print(double area = 2);
int main(){
print();
print(4);
system("pause");
return 0;
}
void print(double area = 1){
cout<<area;
}
上面代码只能修改成下面的样子才可以:
#include<iostream>
using namespace std;
void print(double area = 2);
int main(){
print();
print(4);
system("pause");
return 0;
}
void print(double area){
cout<<area;
}
#include<iostream>
using namespace std;
void print(double area = 2);
int main(){
print();
print(4);
system("pause");
return 0;
}
void print(double area = 1){
cout<<area;
}
上面代码只能修改成下面的样子才可以:
#include<iostream>
using namespace std;
void print(double area = 2);
int main(){
print();
print(4);
system("pause");
return 0;
}
void print(double area){
cout<<area;
}
相关文章推荐
- js函数参数默认值
- 函数参数默认值定义
- java中函数的参数不能设置默认值
- C++ 函数参数的默认值
- C和C++__带默认值参数的函数说明
- C#中的函数参数能不能有默认值的解决方法
- python tips - 注意函数参数的默认值
- 函数的参数默认值
- C++函数参数取默认值
- JavaScript 函数参数默认值
- 函数参数的默认值
- 存储过程,函数--参数默认值的一些问题
- Javascript中嵌入php代码、Javascript中函数参数的默认值
- java函数参数默认值
- JS 自定义函数时,如何定义参数默认值
- [delphi]参数带有默认值的函数
- C++函数参数取默认值
- 虚函数参数的默认值
- java函数参数默认值
- C++ 函数参数的默认值