Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- class SingletonObject
- {
- public:
- static SingletonObject* SingletonObject();
- static void SingletonObject();
- private:
- static SingletonObject* sSingletonObject;
- SingletonObject();
- ~SingletonObject();
- };
- #include "SingletonObject.h"
- SingletonObject* SingletonObject::sSingletonObject = NULL;
- SingletonObject:: SingletonObject()
- {
- }
- SingletonObject::~ SingletonObject()
- {
- }
- SingletonObject* SingletonObject::GetSingleton()
- {
- if (sSingletonObject == NULL) // cache miss
- {
- sSingletonObject = new SingletonObject();
- }
- return sSingletonObject;
- }
- void SingletonObject::DestroySingleton()
- {
- delete sSingletonObject;
- sSingletonObject = NULL;
- }
Add Comment
Please, Sign In to add comment