-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