C++ singleton prevent copy

#include <iostream>

class Singleton {
private:
    Singleton() {}  // Private constructor to prevent direct instantiation
    Singleton(const Singleton&);  // Private copy constructor to prevent copying
    Singleton& operator=(const Singleton&);  // Private copy assignment operator to prevent assignment

public:
    static Singleton& getInstance() {
        static Singleton instance;  // Static instance of the class
        return instance;
    }

    void showMessage() {
        std::cout << "Singleton instance is created." << std::endl;
    }
};

int main() {
    // Attempting to copy or assign the Singleton instance will result in a compilation error
    // Uncommenting the lines below will result in a compilation error
    // Singleton anotherInstance = Singleton::getInstance();
    // Singleton yetAnotherInstance;
    // yetAnotherInstance = Singleton::getInstance();

    Singleton& singletonInstance = Singleton::getInstance();
    singletonInstance.showMessage();

    return 0;
}