fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T>
  5. struct SharedPtr
  6. {
  7. SharedPtr() {}
  8.  
  9. template <class U>
  10. SharedPtr(const SharedPtr<U>& value);
  11.  
  12. T *_value;
  13. };
  14.  
  15. template<typename T>
  16. template<typename U>
  17. SharedPtr<T>::SharedPtr(const SharedPtr<U> &value)
  18. : _value(value._value)
  19. { }
  20.  
  21. struct Base {};
  22. struct Derived : Base {};
  23.  
  24. int main() {
  25.  
  26. SharedPtr<Derived> dS;
  27. SharedPtr<Base> dB(dS);
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty