fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4.  
  5. using namespace std;
  6.  
  7. class header
  8. {
  9. public:
  10. header(void)
  11. {
  12. cout<<"ctor_header"<<endl;
  13. }
  14. ~header(void)
  15. {
  16. cout<<"dtor_header"<<endl;
  17. }
  18. };
  19.  
  20. class func_1 : public header
  21. {
  22. public:
  23. func_1(void)
  24. {
  25. cout<<"ctor_func_1"<<endl;
  26. }
  27. ~func_1(void)
  28. {
  29. cout<<"dtor_func_1"<<endl;
  30. }
  31. };
  32.  
  33. class func_2 : public func_1
  34. {
  35. public:
  36. func_2(void)
  37. {
  38. cout<<"ctor_func_2"<<endl;
  39. }
  40. ~func_2(void)
  41. {
  42. cout<<"dtor_func_2"<<endl;
  43. }
  44. };
  45.  
  46. int main(void)
  47. {
  48. func_2 a;
  49. cout<<endl;
  50.  
  51. return 0;
  52. }
  53.  
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
ctor_header
ctor_func_1
ctor_func_2

dtor_func_2
dtor_func_1
dtor_header