I have created an singleton class, this class returns a database connection. So my question is this connection is also satisfying singleton criteria?
If no, than how I c
Singleton means that the class that you have made can be instantiated only once. So if you want that to happen, do two things:
instantiate the class as:
get
{
if(instance == null) //important coz, the class will be instantiated only on the first call
{
instance = new singletonDb;
}
return instance;
}