I am asking because I am curious while studying the singletone pattern.
I want to know the difference between singletone pattern and static variable.
class A
{
public:
    A() {}
    ~A() {}
};
static A* a;
This
class Singleton
{
private:
    Singleton() {}
    ~Singleton() {}
private:
    static Singleton* m_Singleton;
    
public:
    static Singleton* GetInstance()
    {
        if (m_Singleton == nullptr)
        {
            m_Singleton = new Singleton();
        }
        return m_Singleton;
    }
    static void DestroyInstance()
    {
        if (m_Singleton == nullptr)
        {
            return;
        }
        delete m_Singleton;
        m_Singleton = nullptr;
    }
};
Singleton* Singleton::m_Singleton = nullptr;
I want to know the difference between this. Aren't you creating an object using only one? Or I wonder if there's any difference.
 
     
    