fork download
  1. #include <iostream>
  2. #include <memory> //yeehaww!
  3. //using namespace std; //для пидоров
  4.  
  5. class Yoba
  6. {
  7. public:
  8. Yoba()
  9. {
  10.  
  11. }
  12.  
  13. ~Yoba()
  14. {
  15. std::cout << "Destructed: " << this << std::endl;
  16. }
  17.  
  18. std::shared_ptr<Yoba> method()
  19. {
  20. return std::make_shared<Yoba>();
  21. }
  22.  
  23. void show()
  24. {
  25. std::cout << "123" << std::endl;
  26. }
  27.  
  28. };
  29.  
  30. int main() {
  31. // your code goes here
  32. Yoba y;
  33. auto r = y.method();
  34. r->show();
  35. return 0;
  36. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
123
Destructed: 0x92bf014
Destructed: 0xbf83b8cf