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