fork(4) download
  1. #include <memory>
  2.  
  3. struct X
  4. {
  5. virtual ~X() { }
  6. };
  7.  
  8. struct Y : X
  9. {
  10. };
  11.  
  12. int main()
  13. {
  14. std::shared_ptr<X> pX = std::make_shared<Y>();
  15. std::shared_ptr<Y> pY = std::dynamic_pointer_cast<Y>(pX);
  16. }
  17.  
Success #stdin #stdout 0s 3024KB
stdin
Standard input is empty
stdout
Standard output is empty