-2
这是一个来自极客的极客修改代码。函数参数中v = 0是什么意思
#include<iostream>
using namespace std;
class Test {
int value;
public:
Test(int v = 0) {value = v;}
int getValue() {return value;}
};
int main() {
Test t(20);
cout<<t.getValue();
return 0;
}
函数Test(int v=0)
的参数是什么意思?
或者https://stackoverflow.com/questions/17961277/assigning-parameter-value-in - 功能声明 – Tas