WebHosting

Wednesday, June 29, 2011

Singleton Pattern & its implementation with C++

#include
#include "Singleton.h"
using namespace std;

void useSingleton(){
Singleton* singletoneg= Singleton::getInstance();
singleton->doSummut();

// this shouldn't be allowed
Singleton* doubleton;
doubleton->doSummutElse();
}

int main(int argc, char** argv) {
useSingleton();
return (EXIT_SUCCESS);
}

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

How to add "Copy to" and "Move to" options to the right-click context menu in Windows:

Method 1: Registry Editor (Manual) Note: Back up your registry first or create a system restore point. Add "Copy to" Option:...