fork(1) download
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. class Foo
  6. {
  7. Foo() {}
  8. public:
  9. static std::shared_ptr<Foo> Make()
  10. {
  11. struct Bootstrap : public Foo {};
  12. return std::make_shared<Bootstrap>();
  13. }
  14.  
  15. void Print()
  16. {
  17. std::cout << "Hello, world!";
  18. }
  19. };
  20.  
  21. int main()
  22. {
  23. auto foo = Foo::Make();
  24. foo->Print();
  25. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Hello, world!