fork download
  1. #include <iostream>
  2.  
  3. class MyInt {
  4. private:
  5. int x;
  6. public:
  7. MyInt(int const y): x( y )
  8. { std::cout << "Constructor 1 called." << std::endl; }
  9. MyInt(MyInt const &y): x( y.x )
  10. { std::cout << "Constructor 2 called." << std::endl; }
  11. };
  12.  
  13. int main(void)
  14. {
  15. MyInt i = 1;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
Constructor 1 called.