پاسخ داده شده: کلاسی که فقط یک شی از آن ساخته شود
class Singleton final { public: static Singleton& getInstance() { static Singleton theInstance{}; retu theInstance; } int doSomething() { retu 42; } // ...more member functions doing more or less useful things here... private: Singleton() = default; Singleton(const Singleton&) = delete; Singleton(Singleton&&) = delete; Singleton& operator=(const Singleton&) = delete; Singleton& operator=(Singleton&&) = delete; // ... };