fork download
  1. #include <iostream>
  2. #include <memory>
  3.  
  4. struct A
  5. {
  6. ~A() { std::cout << "~A\n"; }
  7. };
  8.  
  9. struct B : A
  10. {
  11. ~B() { std::cout << "~B\n"; }
  12. };
  13.  
  14. int
  15. main()
  16. {
  17. std::shared_ptr<A> a = std::shared_ptr<B>(new B);
  18. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
~B
~A