#include <iostream>
using namespace std;

class A {
public:
    static A *getInstance() {
        if (instance == NULL)
            instance = new A();
        return instance;
    }
    void affiche() const { cout << this << endl; }
private:
    A() { } // prive donc personne ne peut creer un A
    static A *instance;
};
A *A::instance = NULL;

int main() {
    A *a = A::getInstance();
    A *b = A::getInstance();
    a->affiche();
    b->affiche();
    return 0;
}
