fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class T
  5. {
  6. int _i;
  7. public:
  8. T(int i) {
  9. _i=i;
  10. cout << "construction of T" << endl;
  11. };
  12.  
  13. virtual void f() { };
  14.  
  15. ~T() {
  16. cout << "destruction of T" << endl;
  17. };
  18. };
  19.  
  20. class T1: public T
  21. {
  22. public:
  23. T1() : T(1) {
  24. cout << "construction of T1" << endl;
  25. };
  26.  
  27. virtual void f() { };
  28.  
  29. ~T1() {
  30. cout << "destruction of T1" << endl;
  31. };
  32. };
  33.  
  34. int main() {
  35. T* t1 = new T1();
  36. delete t1;
  37. return 0;
  38. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
construction of T
construction of T1
destruction of T