fork download
  1. #include <iostream>
  2.  
  3. class Test
  4. {
  5. public:
  6. unsigned int m_Variable;
  7. };
  8.  
  9. class Test2
  10. {
  11. public:
  12. Test2 (
  13. void
  14. ) = default;
  15.  
  16. unsigned int m_Variable;
  17. };
  18.  
  19. class Test3
  20. {
  21. public:
  22. Test3 (
  23. void
  24. )
  25. {
  26. }
  27.  
  28. unsigned int m_Variable;
  29. };
  30.  
  31. class Test4
  32. {
  33. public:
  34. Test4 (
  35. void
  36. ) :
  37. m_Variable(0L)
  38. {
  39. }
  40.  
  41. unsigned int m_Variable;
  42. };
  43.  
  44. int
  45. main (
  46. void
  47. )
  48. {
  49. //
  50. // Using "Test":
  51. //
  52. printf("Test:\n\n");
  53.  
  54. Test a1;
  55. printf("%i\n", a1.m_Variable);
  56.  
  57. Test* a2 = new Test;
  58. printf("%i\n", a2->m_Variable);
  59. delete a2;
  60.  
  61. Test* a3 = new Test();
  62. printf("%i\n", a3->m_Variable);
  63. delete a3;
  64.  
  65. printf("\n");
  66.  
  67. //
  68. // Using "Test2":
  69. //
  70. printf("Test2:\n\n");
  71.  
  72. Test2 b1;
  73. printf("%i\n", b1.m_Variable);
  74.  
  75. Test2* b2 = new Test2;
  76. printf("%i\n", b2->m_Variable);
  77. delete a2;
  78.  
  79. Test2* b3 = new Test2();
  80. printf("%i\n", b3->m_Variable);
  81. delete b3;
  82.  
  83. printf("\n");
  84.  
  85. //
  86. // Using "Test3":
  87. //
  88. printf("Test3:\n\n");
  89.  
  90. Test3 c1;
  91. printf("%i\n", c1.m_Variable);
  92.  
  93. Test3* c2 = new Test3;
  94. printf("%i\n", c2->m_Variable);
  95. delete c2;
  96.  
  97. Test3* c3 = new Test3();
  98. printf("%i\n", c3->m_Variable);
  99. delete c3;
  100.  
  101. printf("\n");
  102.  
  103. //
  104. // Using "Test4":
  105. //
  106. printf("Test4:\n\n");
  107.  
  108. Test4 d1;
  109. printf("%i\n", d1.m_Variable);
  110.  
  111. Test4* d2 = new Test4;
  112. printf("%i\n", d2->m_Variable);
  113. delete d2;
  114.  
  115. Test4* d3 = new Test4();
  116. printf("%i\n", d3->m_Variable);
  117. delete d3;
  118.  
  119. printf("\n");
  120.  
  121. return 0;
  122. }
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
Test:

0
0
0

Test2:

0
0
0

Test3:

0
0
0

Test4:

0
0
0