fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Other {
  5. public:
  6. ~Other() {
  7. std::cout << "Other Destroyed" << std::endl;
  8. }
  9. };
  10.  
  11. class Base {
  12. public:
  13. ~Base(){}
  14. };
  15.  
  16. class Derived : public Base {
  17. private:
  18. Other o;
  19. public:
  20. ~Derived(){}
  21. };
  22.  
  23. int main() {
  24. Base *b = new Derived();
  25. delete b;
  26. }
  27.  
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
Standard output is empty