#include class Test { private: int _a; int& _b = _a; public: Test() { _a = 5; std::cout << "Normal constructor" << std::endl; } Test(const Test& rhs) { _a = rhs._a; std::cout << "copy constructor" << std::endl; } void printValue() { std::cout << _a << "---" << std::endl; } void setA (int a) { _a = a; } }; void temp(Test& t) { t.setA(10); t.printValue(); } int main() { Test t; temp(t); t.printValue(); return 0; }