fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. class Test
  5. {
  6. public:
  7.  
  8. int a;
  9.  
  10. Test()
  11. {
  12. puts("Test()\r\n");
  13. }
  14.  
  15. explicit Test(int)
  16. {
  17. puts("Test(int)\r\n");
  18. }
  19.  
  20. Test(const Test&)
  21. {
  22. puts("Test(const Test&)\r\n");
  23. }
  24.  
  25. Test& operator = (const Test&)
  26. {
  27. puts("Test::operator = (const Test&)\r\n");
  28. return *this;
  29. }
  30.  
  31. Test(Test&&)
  32. {
  33. puts("Test(Test&&)\r\n");
  34. }
  35.  
  36. Test& operator = (Test&&)
  37. {
  38. puts("Test::operator = (Test&&)\r\n");
  39. return *this;
  40. }
  41. };
  42.  
  43. Test GetTest()
  44. {
  45. return Test(rand());
  46. }
  47.  
  48. int main()
  49. {
  50. Test t;
  51.  
  52. Test t1(t);
  53. Test t2 = t;
  54.  
  55. Test t3(GetTest());
  56. Test t4 = Test();
  57.  
  58. Test t5 = Test(t);
  59.  
  60. t1 = t;
  61. t2 = Test();
  62. return 0;
  63. }
  64.  
Success #stdin #stdout 0s 4492KB
stdin
Standard input is empty
stdout
Test()

Test(const Test&)

Test(const Test&)

Test(int)

Test()

Test(const Test&)

Test::operator = (const Test&)

Test()

Test::operator = (Test&&)