J
John Eskie
Lets say I want to make multiply classes as singletons. A singleton skeleton
would be with a static member variable of the instance and a GetInstance
function.
Currently I have this functionality in all the classes where I need it but
I'd like to use templates or some other language construct so I can remove
the duplicated code.
A small example of what I'd like to do:
Singleton class functionality:
T *instance;
T *GetInstance();
....
class A
{
....implements the above
int varA;
};
Class B
{
.... also implements singleton
double varB;
};
Thanks in advance.
-- John
would be with a static member variable of the instance and a GetInstance
function.
Currently I have this functionality in all the classes where I need it but
I'd like to use templates or some other language construct so I can remove
the duplicated code.
A small example of what I'd like to do:
Singleton class functionality:
T *instance;
T *GetInstance();
....
class A
{
....implements the above
int varA;
};
Class B
{
.... also implements singleton
double varB;
};
Thanks in advance.
-- John