fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Test {
  5. public:
  6. int value;
  7. Test(int value) { cout << "Constructed!" << endl; this->value = value; }
  8. Test(const Test& other) { cout << "Copy constructed!" << endl; this->value = other.value; }
  9. };
  10.  
  11. Test make_test(int value) {
  12. return Test(value);
  13. }
  14.  
  15. int main() {
  16. Test t = make_test(3);
  17. return 0;
  18. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Constructed!