Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. //SINGLETON.h
  2. class Singleton {
  3. public:
  4. static Singleton* Instance();
  5. protected:
  6. Singleton();
  7. private:
  8. static Singleton* _instance;
  9. }
  10.  
  11. // Implementation
  12. Singleton* Singleton::_instance = 0;
  13.  
  14. Singleton* Singleton::Instance() {
  15. if (_instance == 0) {
  16. _instance = new Singleton;
  17. }
  18. return _instance;
  19. }
  20.  
  21. ////singleton.cpp
  22.  
  23. #include "singleton.h"
  24.  
  25.  
  26.  
  27. if (ConfigurationManager::GetInstance()->isValid())
  28. {
  29. std::string host=
  30. ConfigurationManager::GetInstance()->GetPop3host();
  31. std::string user=
  32. ConfigurationManager::GetInstance()->GetPop3user();
  33. std::string pass=
  34. ConfigurationManager::GetInstance()->GetPop3pass();
  35. std::string xmlPath=
  36. ConfigurationManager::GetInstance()->GetXMLPath();
  37. }
  38. //main.cpp
  39. #include "singleton.cpp"
  40. #include <stdio.h>
  41. #include <iostream>
  42. #include <stdlib.h>
  43. int main()
  44. {
  45. std::cout<<"test";
  46.  
  47.  
  48.  
  49.  
  50.  
  51. system("PAUSE");
  52. return 0;
  53. }
  54.  
  55. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement