Singleton* instance;
/* Private constructor to prevent instancing. */
Singleton();
public:
/* Static access method. */
static Singleton* getInstance();
};
/* Null, because instance will be initialized on demand. */
Singleton* Singleton::instance = 0;
...
Hi. Can you explain me how is the private member instance accessed in the last line? (P.S. I know that this code has a mem leak,I took the code from GitHub)
it's a static initialization of a private member
Обсуждают сегодня