fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class CTest
  6. {
  7. public:
  8. CTest() {cout << "CTest Constr\n";}
  9. ~CTest() {cout << "DEST CTest\n";}
  10. };
  11.  
  12.  
  13. class CTest2:public CTest
  14. {
  15. public:
  16. CTest2() {cout << "Test2 Constr\n";}
  17. ~CTest2() {cout << "DEST Test2\n";}
  18. };
  19.  
  20.  
  21. int main() {
  22.  
  23. cout << "main start\n";
  24.  
  25. {
  26. CTest* hej = new CTest2;
  27. delete hej;
  28. }
  29.  
  30. cout << "main end\n";
  31. // your code goes here
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
main start
CTest Constr
Test2 Constr
DEST CTest
main end