Open Crazyokd opened 1 year ago
you can verify it by execute code below:
#include <iostream> using namespace std; class X { public: int mysn = 0; X() {} X(const X&orig): mysn(orig.mysn + 1) { cout << "copy constructor " << (orig.mysn + 1) << endl; } }; void f (const X &x) { cout << x.mysn << endl; } int main() { X a, b = a, c = b; f(a); f(b); f(c); return 0; }
you can verify it by execute code below: