posted 18 years ago
make the constructor private and have a public static method which will instantiate a instance but before instantiating check whether the variable is null or not
e.g.
public class SingleInstance
{
private SingleInstance()
{
}
private singleInstance;
public static SingleInstance returnSingleInstance()
{
if(singleInstance == null)
{
singleInstance = new SingleInstance();
}
return singleInstance;
}
}
[ September 05, 2005: Message edited by: BalajiS Sridharan ]