fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base
  5. {
  6. public:
  7. Base(){}
  8. virtual ~Base(){std::cout << "\nBaseDTOR" << std::endl;}
  9. };
  10.  
  11. class Derived : public Base
  12. {
  13. public:
  14. Derived() : Base() {}
  15. //~Derived(){ std::cout << "\nDrvdDTOR" << std::endl; }
  16. };
  17.  
  18. int main() {
  19. Base* b = new Derived();
  20. delete (b);
  21. return 0;
  22. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
BaseDTOR