fork(1) download
  1. template<typename T>
  2. class Singleton
  3. {
  4. public:
  5. static T & get()
  6. {
  7. static T instance;
  8. return instance;
  9. }
  10.  
  11. protected:
  12. Singleton() {}
  13. };
  14.  
  15. class Yoba : public Singleton<Yoba>
  16. {
  17. };
  18.  
  19. int main()
  20. {
  21. Yoba x;
  22. Yoba::get();
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty