Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SINGLETON.h
- class Singleton {
- public:
- static Singleton* Instance();
- protected:
- Singleton();
- private:
- static Singleton* _instance;
- }
- // Implementation
- Singleton* Singleton::_instance = 0;
- Singleton* Singleton::Instance() {
- if (_instance == 0) {
- _instance = new Singleton;
- }
- return _instance;
- }
- ////singleton.cpp
- #include "singleton.h"
- if (ConfigurationManager::GetInstance()->isValid())
- {
- std::string host=
- ConfigurationManager::GetInstance()->GetPop3host();
- std::string user=
- ConfigurationManager::GetInstance()->GetPop3user();
- std::string pass=
- ConfigurationManager::GetInstance()->GetPop3pass();
- std::string xmlPath=
- ConfigurationManager::GetInstance()->GetXMLPath();
- }
- //main.cpp
- #include "singleton.cpp"
- #include <stdio.h>
- #include <iostream>
- #include <stdlib.h>
- int main()
- {
- std::cout<<"test";
- system("PAUSE");
- return 0;
- }
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement