fork(11) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Demo {
  5. Demo() = delete;
  6. Demo(int _x) : x(_x) { cout << "one-arg constructor" << endl; }
  7. Demo(const Demo& other) : Demo(other.x) {cout << "copy constructor" << endl; }
  8. int x;
  9. };
  10.  
  11. int main() {
  12. Demo a(5);
  13. Demo b(a);
  14. return 0;
  15. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
one-arg constructor
one-arg constructor
copy constructor