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

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...