我们首先看一段程序:
class A {
private:
int i;
public:
A(int i): i(i) {}
void print(A a) {
cout << a.i <<endl;
}
};
int main() {
A B(5);
A C(4);
B.print(C);
return 0;
}
编译通过,程序运行结果为:
4
Process returned 0 (0x0) execution time :