专题博客链接
原题题目
#include <iostream>
using namespace std;
class Sample {
public:
int v;
// 在此处补充你的代码
};
void PrintAndDouble(Sample o)
{
cout << o.v;
cout << endl;
}
int main()
{
Sample a(5);
Sample b = a;
PrintAndDouble(b);
Sample c = 20;
PrintAndDouble(c);
Sample d;
d = a;
cout << d.v;
return 0;
}
代码实现
Sample(const Sample & a)
{
v = (a.v+2);
}
Sample(int a)
{
v = a;
}
Sample()
{
v = 22;
}